Package net.neoforged.testframework
Interface DynamicTest
- All Known Implementing Classes:
AbstractTest.Dynamic
,MethodBasedEventTest
,MethodBasedGameTestTest
,MethodBasedTest
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.testframework.Test
Test.EventListenerGroup, Test.Result, Test.Status, Test.Visuals
-
Method Summary
Modifier and TypeMethodDescriptionReturns a computed mod id based on this test's ID.Returns a listener group used to subscribe to events when the test is enabled.default void
Marks this test as failed.Returns the framework this test is linked to.boolean
Returns if this test is currently running as a GameTest.<T extends GameTestHelper>
voidonGameTest
(Class<T> helperType, Consumer<T> consumer) Registers a listener to run when the GameTest version of this test is run.default void
onGameTest
(Consumer<ExtendedGameTestHelper> consumer) Registers a listener to run when the GameTest version of this test is run.default void
pass()
Marks this test as passed.default void
Register the template for this game test.default void
Register the template for this game test.Returns a new registration helper with a computed mod ID.registrationHelper
(String modId) Returns a new registration helper with the givenmodId
.void
requestConfirmation
(Player player, Component message) Requests a confirmation of the test passing from a player.default Test.Status
status()
Returns the status of this test.default void
updateStatus
(Test.Status newStatus, @Nullable Entity updater) Updates the status of the test.void
whenDisabled
(Runnable whenDisabled) Registers a listener to run when this test is disabled.void
whenEnabled
(DynamicTest.EnabledListener whenEnabled) Registers a listener to run when this test is enabled.Methods inherited from interface net.neoforged.testframework.Test
asGameTest, enabledByDefault, groups, id, init, listeners, onDisabled, onEnabled, resolveAll, resolveAsStream, visuals
-
Method Details
-
framework
TestFramework framework()Returns the framework this test is linked to.- Returns:
- the framework this test is linked to
-
status
Returns the status of this test.- Returns:
- the status of this test
-
updateStatus
Updates the status of the test.- Parameters:
newStatus
- the new statusupdater
- the entity which updated the status
-
pass
default void pass()Marks this test as passed. -
fail
Marks this test as failed.- Parameters:
message
- additional information explaining why the test failed
-
whenEnabled
Registers a listener to run when this test is enabled.- Parameters:
whenEnabled
- the listener
-
eventListeners
Test.EventListenerGroup eventListeners()Returns a listener group used to subscribe to events when the test is enabled.- Returns:
- a listener group used to subscribe to events when the test is enabled
- See Also:
-
whenDisabled
Registers a listener to run when this test is disabled.- Parameters:
whenDisabled
- the listener
-
onGameTest
Registers a listener to run when the GameTest version of this test is run.- Parameters:
consumer
- the listener
-
onGameTest
Registers a listener to run when the GameTest version of this test is run.- Parameters:
helperType
- the type to use for the helperconsumer
- the listener
-
registerGameTestTemplate
Register the template for this game test.- Parameters:
builder
- the builder of the template
-
registerGameTestTemplate
Register the template for this game test.- Parameters:
builder
- a supplier of the builder of the template
-
registrationHelper
Returns a new registration helper with the givenmodId
.- Returns:
- a new registration helper with the given
modId
-
registrationHelper
RegistrationHelper registrationHelper()Returns a new registration helper with a computed mod ID.- Returns:
- a new registration helper with a computed mod ID
-
createModId
String createModId()Returns a computed mod id based on this test's ID.- Returns:
- a computed mod id based on this test's ID
-
isDuringGameTest
boolean isDuringGameTest()Returns if this test is currently running as a GameTest.- Returns:
- if this test is currently running as a GameTest
-
requestConfirmation
Requests a confirmation of the test passing from a player.- Parameters:
player
- the player to request the confirmation frommessage
- the confirmation message
-