Package net.neoforged.testframework
Interface Test
- All Superinterfaces:
Groupable
- All Known Subinterfaces:
DynamicTest
- All Known Implementing Classes:
AbstractTest
,AbstractTest.Dynamic
,MethodBasedEventTest
,MethodBasedGameTestTest
,MethodBasedTest
The base interface for tests in the TestFramework.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
A group of collectors bybus
.static enum
static final record
Represents the status of a test.static final record
Used by GUIs in order to display helpful information about tests. -
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable GameTestData
Returns the game test version of this test.boolean
Returns if this test is enabled by default.groups()
A list of the groups of this test.id()
Returns the ID of this test.void
init
(TestFramework framework) This method is called when the test is registered to aTestFramework
.default Collection<TestListener>
Returns the listeners of this test.void
This method is called when this test is disabled.void
onEnabled
(Test.EventListenerGroup buses) This method is called when this test is enabled.Resolves all tests in this groupable element.Resolves all tests in this groupable element as aStream
.visuals()
Returns the visual information about the test.
-
Method Details
-
id
String id()Returns the ID of this test.- Returns:
- the ID of this test
-
groups
A list of the groups of this test.
If this list is empty, the test will be only in theungrouped
group.- Returns:
- the groups of this test
-
enabledByDefault
boolean enabledByDefault()Returns if this test is enabled by default.- Returns:
- if this test is enabled by default
-
onEnabled
This method is called when this test is enabled.- Parameters:
buses
- a collector for event listeners. Prefer using this listener instead of the casualIEventBus.addListener(Consumer)
orIEventBus.register(Object)
, as the collector will automatically unregister listeners when the test is disabled
-
onDisabled
void onDisabled()This method is called when this test is disabled. -
init
This method is called when the test is registered to aTestFramework
.- Parameters:
framework
- the framework the test has been registered to
-
visuals
Test.Visuals visuals()Returns the visual information about the test.- Returns:
- the visual information about the test
-
resolveAsStream
Resolves all tests in this groupable element as aStream
.- Specified by:
resolveAsStream
in interfaceGroupable
- Returns:
- all tests as a stream
-
resolveAll
Resolves all tests in this groupable element.- Specified by:
resolveAll
in interfaceGroupable
- Returns:
- all tests
-
asGameTest
Returns the game test version of this test.- Returns:
- the game test version of this test
-
listeners
Returns the listeners of this test.- Returns:
- the listeners of this test
-