Class CountingCheckpoint

java.lang.Object
io.vertx.junit5.CountingCheckpoint
All Implemented Interfaces:
Completable<Object>, Checkpoint

public final class CountingCheckpoint extends Object implements Checkpoint
Checkpoints that count the number of flag invocations.
Author:
Julien Ponge
  • Method Details

    • laxCountingCheckpoint

      public static CountingCheckpoint laxCountingCheckpoint(Consumer<Checkpoint> satisfactionTrigger, int requiredNumberOfPasses)
    • strictCountingCheckpoint

      public static CountingCheckpoint strictCountingCheckpoint(Consumer<Checkpoint> satisfactionTrigger, Consumer<Throwable> overuseTrigger, int requiredNumberOfPasses)
    • laxCountingCheckpoint

      public static CountingCheckpoint laxCountingCheckpoint(BiConsumer<Checkpoint, Throwable> satisfactionTrigger, int requiredNumberOfPasses)
    • strictCountingCheckpoint

      public static CountingCheckpoint strictCountingCheckpoint(BiConsumer<Checkpoint, Throwable> satisfactionTrigger, Consumer<Throwable> overuseTrigger, int requiredNumberOfPasses)
    • asLatch

      public CountDownLatch asLatch(int count)
      Description copied from interface: Checkpoint
      Creates a new CountDownLatch that succeeds this checkpoint when the count reaches 0.
      Specified by:
      asLatch in interface Checkpoint
      Parameters:
      count - the latch count
      Returns:
      the new latch
    • complete

      public void complete(Object result, Throwable failure)
      Description copied from interface: Completable
      Complete this instance
      • when failure is null, a success is signaled
      • otherwise a failure is signaled
      Specified by:
      complete in interface Completable<Object>
      Parameters:
      result - the result
      failure - the failure
    • flag

      public void flag()
      Description copied from interface: Checkpoint
      Flags the checkpoint.
      Specified by:
      flag in interface Checkpoint
    • await

      public void await(Duration timeout)
      Description copied from interface: Checkpoint

      Waits until the checkpoint is satisfied or canceled or the timeout fires, this can be used to coordinate the overall flow of a test:

      • when the checkpoint is satisfied the flow continues and the next statement will be executed
      • when the test fails, the checkpoint is cancelled and a CancellationException is thrown
      • when the timeout fires, TimeoutException is thrown

      This blocks the thread caller, it should never be used from the event-loop, usually it is called from the JUnit thread that coordinates with asynchronous parts of the test.

      Specified by:
      await in interface Checkpoint
      Parameters:
      timeout - the max wait time.
    • satisfied

      public boolean satisfied()
    • creationCallSite

      public StackTraceElement creationCallSite()