use of io.engineblock.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferReadable in project engineblock by engineblock.
the class CycleResultsRLEBufferReadableTest method testIteratorExhausted.
@Test
public void testIteratorExhausted() {
CycleResultsRLEBufferTarget t = new CycleResultsRLEBufferTarget(1000);
t.onCycleResult(1L, 5);
t.onCycleResult(2L, 6);
t.onCycleResult(4L, 8);
CycleResultsRLEBufferReadable cr = t.toSegmentsReadable();
Iterator<CycleResultsSegment> iterator = cr.iterator();
CycleResultsSegment s1 = iterator.next();
assertThat(s1.getCount()).isEqualTo(1);
CycleResultsSegment s2 = iterator.next();
assertThat(s2.getCount()).isEqualTo(1);
CycleResultsSegment s3 = iterator.next();
assertThat(s3.getCount()).isEqualTo(1);
assertThat(iterator.hasNext()).isFalse();
// long[] cycleValues = StreamSupport.stream(cr.spliterator(), false)
// .mapToLong(CycleResult::getCycle).toArray();
// int[] resultValues = StreamSupport.stream(cr.spliterator(), false)
// .mapToInt(CycleResult::getResult).toArray();
//
// assertThat(cycleValues).containsExactly(1L, 2L, 4L);
// assertThat(resultValues).containsExactly(5, 6, 8);
//
}
Aggregations