use of io.spine.server.projection.BulkWriteOperation.FlushCallback in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method complete_on_timeout.
@SuppressWarnings("MagicNumber")
@Test
public void complete_on_timeout() throws InterruptedException {
final Duration duration = Durations2.nanos(1L);
final FlushCallback callback = spy(new EmptyCallback());
// Due to `spy` usage
@SuppressWarnings("unchecked") final BulkWriteOperation operation = spy(new BulkWriteOperation(duration, callback));
assertTrue(operation.isInProgress());
Thread.sleep(10L);
operation.checkExpiration();
assertFalse(operation.isInProgress());
verify(operation).complete();
verify(callback).onFlushResults(any(Set.class), any(Timestamp.class));
}
Aggregations