@Test
void batchedStreamOf_exact() {

    Stream<Integer> sourceStream = IntStream.rangeClosed(1, 10)
            .boxed();
    List<List<Integer>> batches = BatchingIterator.batchedStreamOf(sourceStream, 5)
            .collect(Collectors.toList());
    assertThat(batches).hasSize(2);
    assertThat(batches.get(0)).containsExactly(1, 2, 3, 4, 5);
    assertThat(batches.get(1)).containsExactly(6, 7, 8, 9, 10);
}