Class CountingCheckpoint
java.lang.Object
io.vertx.junit5.CountingCheckpoint
- All Implemented Interfaces:
Completable<Object>, Checkpoint
Checkpoints that count the number of flag invocations.
- Author:
- Julien Ponge
-
Method Summary
Modifier and TypeMethodDescriptionasLatch(int count) Creates a newCountDownLatchthat succeeds this checkpoint when the count reaches 0.voidWaits until the checkpoint is satisfied or canceled or thetimeoutfires, this can be used to coordinate the overall flow of a test:voidComplete this instance whenfailureisnull, a success is signaled otherwise a failure is signaledvoidflag()Flags the checkpoint.static CountingCheckpointlaxCountingCheckpoint(BiConsumer<Checkpoint, Throwable> satisfactionTrigger, int requiredNumberOfPasses) static CountingCheckpointlaxCountingCheckpoint(Consumer<Checkpoint> satisfactionTrigger, int requiredNumberOfPasses) booleanstatic CountingCheckpointstrictCountingCheckpoint(BiConsumer<Checkpoint, Throwable> satisfactionTrigger, Consumer<Throwable> overuseTrigger, int requiredNumberOfPasses) static CountingCheckpointstrictCountingCheckpoint(Consumer<Checkpoint> satisfactionTrigger, Consumer<Throwable> overuseTrigger, int requiredNumberOfPasses) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Checkpoint
awaitMethods inherited from interface Completable
fail, fail, succeed, succeed
-
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
Description copied from interface:CheckpointCreates a newCountDownLatchthat succeeds this checkpoint when the count reaches 0.- Specified by:
asLatchin interfaceCheckpoint- Parameters:
count- the latch count- Returns:
- the new latch
-
complete
Description copied from interface:CompletableComplete this instance- when
failureisnull, a success is signaled - otherwise a failure is signaled
- Specified by:
completein interfaceCompletable<Object>- Parameters:
result- the resultfailure- the failure
- when
-
flag
public void flag()Description copied from interface:CheckpointFlags the checkpoint.- Specified by:
flagin interfaceCheckpoint
-
await
Description copied from interface:CheckpointWaits 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.
- Specified by:
awaitin interfaceCheckpoint- Parameters:
timeout- the max wait time.
-
satisfied
public boolean satisfied() -
creationCallSite
-