Interface Checkpoint
- All Superinterfaces:
Completable<Object>
- All Known Implementing Classes:
CountingCheckpoint
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 TypeMethodDescriptionasLatch(int count) Creates a newCountDownLatchthat succeeds this checkpoint when the count reaches 0.default voidawait()Callsawait(Duration)with a timeout of 2O seconds.voidWaits until the checkpoint is satisfied or canceled or thetimeoutfires, this can be used to coordinate the overall flow of a test:voidflag()Flags the checkpoint.
-
Method Details
-
flag
void flag()Flags the checkpoint. -
asLatch
Creates a newCountDownLatchthat succeeds this checkpoint when the count reaches 0.- Parameters:
count- the latch count- Returns:
- the new latch
-
await
default void await()Callsawait(Duration)with a timeout of 2O seconds. -
await
Waits until the checkpoint is satisfied or canceled or the
timeoutfires, 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
CancellationExceptionis thrown - when the timeout fires,
TimeoutExceptionis 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.
-