@Test
public void testFilter() throws Exception {

    DataGenerator<List<Long>> filteredBatch = DataGenerator.range(0, 9).filter(v -> v % 2 == 0).batch(5);
    assertThat(filteredBatch.getValue()).contains(0L, 2L, 4L, 6L, 8L);
    assertThat(filteredBatch.isClosed()).isFalse();
    assertThat(filteredBatch.apply().isClosed()).isTrue();
}