接口 DynamicTest

所有超级接口:
Groupable, Test
所有已知实现类:
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.
  • 方法详细资料

    • framework

      TestFramework framework()
      返回 the framework this test is linked to。
      返回:
      the framework this test is linked to
    • status

      default Test.Status status()
      返回 the status of this test。
      返回:
      the status of this test
    • updateStatus

      default void updateStatus(Test.Status newStatus, @Nullable @Nullable Entity updater)
      Updates the status of the test.
      参数:
      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.
      参数:
      message - additional information explaining why the test failed
    • whenEnabled

      void whenEnabled(DynamicTest.EnabledListener whenEnabled)
      Registers a listener to run when this test is enabled.
      参数:
      whenEnabled - the listener
    • eventListeners

      Test.EventListenerGroup eventListeners()
      返回 a listener group used to subscribe to events when the test is enabled。
      返回:
      a listener group used to subscribe to events when the test is enabled
      另请参阅:
    • whenDisabled

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

      default void onGameTest(Consumer<ExtendedGameTestHelper> consumer)
      Registers a listener to run when the GameTest version of this test is run.
      参数:
      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.
      参数:
      helperType - the type to use for the helper
      consumer - the listener
    • registerGameTestTemplate

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

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

      RegistrationHelper registrationHelper(String modId)
      返回 a new registration helper with the given modId
      返回:
      a new registration helper with the given modId
    • registrationHelper

      RegistrationHelper registrationHelper()
      返回 a new registration helper with a computed mod ID。
      返回:
      a new registration helper with a computed mod ID
    • createModId

      String createModId()
      返回 a computed mod id based on this test's ID。
      返回:
      a computed mod id based on this test's ID
    • isDuringGameTest

      boolean isDuringGameTest()
      返回 if this test is currently running as a GameTest。
      返回:
      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.
      参数:
      player - the player to request the confirmation from
      message - the confirmation message