Interface DynamicTest

All Superinterfaces:
Groupable, Test
All Known Implementing Classes:
AbstractTest.Dynamic, MethodBasedEventTest, MethodBasedGameTestTest, MethodBasedTest

@ParametersAreNonnullByDefault public interface DynamicTest extends Test
A special type of test which may only be linked to one framework at a time.
This type of test can have enabled/disabled listeners added dynamically, and is as such, used primarily by method-based tests.
  • Method Details

    • framework

      TestFramework framework()
      Returns the framework this test is linked to.
      Returns:
      the framework this test is linked to
    • status

      default Test.Status status()
      Returns the status of this test.
      Returns:
      the status of this test
    • updateStatus

      default void updateStatus(Test.Status newStatus, @Nullable @Nullable Entity updater)
      Updates the status of the test.
      Parameters:
      newStatus - the new status
      updater - the entity which updated the status
    • pass

      default void pass()
      Marks this test as passed.
    • fail

      default void fail(String message)
      Marks this test as failed.
      Parameters:
      message - additional information explaining why the test failed
    • whenEnabled

      void whenEnabled(DynamicTest.EnabledListener 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

      void whenDisabled(Runnable whenDisabled)
      Registers a listener to run when this test is disabled.
      Parameters:
      whenDisabled - the listener
    • onGameTest

      default void onGameTest(Consumer<ExtendedGameTestHelper> consumer)
      Registers a listener to run when the GameTest version of this test is run.
      Parameters:
      consumer - the listener
    • onGameTest

      <T extends GameTestHelper> void onGameTest(Class<T> helperType, Consumer<T> consumer)
      Registers a listener to run when the GameTest version of this test is run.
      Parameters:
      helperType - the type to use for the helper
      consumer - the listener
    • registerGameTestTemplate

      default void registerGameTestTemplate(StructureTemplateBuilder builder)
      Register the template for this game test.
      Parameters:
      builder - the builder of the template
    • registerGameTestTemplate

      default void registerGameTestTemplate(Supplier<StructureTemplateBuilder> builder)
      Register the template for this game test.
      Parameters:
      builder - a supplier of the builder of the template
    • registrationHelper

      RegistrationHelper registrationHelper(String modId)
      Returns a new registration helper with the given modId.
      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

      void requestConfirmation(Player player, Component message)
      Requests a confirmation of the test passing from a player.
      Parameters:
      player - the player to request the confirmation from
      message - the confirmation message