Interface Checkpoint

All Superinterfaces:
Completable<Object>
All Known Implementing Classes:
CountingCheckpoint

public interface Checkpoint extends Completable<Object>
A test completion checkpoint, flagging it advances towards the test context completion.

A checkpoint extends Completable<Object>, which means it can be used as a Future listener. When the future succeeds, the checkpoint is flagged; when the future fails, the error is reported and the test fails.

Example — using a checkpoint as a future listener:

Checkpoint checkpoint = ctx.checkpoint();
vertx.deployVerticle(new MyVerticle())
  .onComplete(checkpoint);
Author:
Julien Ponge
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    asLatch(int count)
    Creates a new CountDownLatch that succeeds this checkpoint when the count reaches 0.
    default void
    Calls await(Duration) with a timeout of 2O seconds.
    void
    await(Duration timeout)
    Waits until the checkpoint is satisfied or canceled or the timeout fires, this can be used to coordinate the overall flow of a test:
    void
    Flags the checkpoint.

    Methods inherited from interface Completable

    complete, fail, fail, succeed, succeed
  • Method Details

    • flag

      void flag()
      Flags the checkpoint.
    • asLatch

      CountDownLatch asLatch(int count)
      Creates a new CountDownLatch that succeeds this checkpoint when the count reaches 0.
      Parameters:
      count - the latch count
      Returns:
      the new latch
    • await

      default void await()
      Calls await(Duration) with a timeout of 2O seconds.
    • await

      void await(Duration timeout)

      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.

      Parameters:
      timeout - the max wait time.