atMost( sleepMillis + 5000, MILLISECONDS ).
until( taskOutput( taskIdentity ), equalTo( BAR ) );
try( UnitOfWork uow = module.newUnitOfWork( usecase ) )
{
Timeline timeline = module.findService( Timeline.class ).get();
DateTime now = new DateTime();
// Queries returning past records
assertThat( count( timeline.getLastRecords( 5 ) ),
is( 2L ) );
assertThat( count( timeline.getRecords( start.getMillis(), now.getMillis() ) ),
is( 2L ) );
// Queries returning future records
assertThat( count( timeline.getNextRecords( 4 ) ),
is( 4L ) );
assertThat( count( timeline.getRecords( now.getMillis() + 100, now.plusMinutes( 5 ).getMillis() ) ),
is( 5L ) );
// Queries returning mixed past and future records
assertThat( count( timeline.getRecords( start.getMillis(), now.plusMinutes( 5 ).getMillis() ) ),
is( 7L ) );
}
}