Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoten committed Dec 3, 2024
1 parent a78fb82 commit 8c1933c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions kool/src/test/java/org/davidmoten/kool/StreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,24 @@ public void testBufferWhileWithStepSmallerThanBufferedListDontEmitRemainderUseBu
Lists.newArrayList(2, 3, 4, 5), //
Lists.newArrayList(3, 4, 5, 6));
}

@Test
public void testBufferWhileWithStepSmallerThanBufferedListDontEmitRemainderUseBuilderWithFactory() {
Stream.of(1, 2, 3, 4, 5, 6, 7) //
.bufferWhile() //
.factory(ArrayList::new) //
.condition((list, t) -> list.size() <= 3) //
.accumulator((list, t)-> {list.add(t); return list;}) //
.step(1) //
.emitRemainder(false) //
.maxReplay(100)
.build()
.test() //
.assertValuesOnly( //
Lists.newArrayList(1, 2, 3, 4), //
Lists.newArrayList(2, 3, 4, 5), //
Lists.newArrayList(3, 4, 5, 6));
}

@Test(expected = NoSuchElementException.class)
public void testBufferUntilWithStepWhenEmptyAndNextCalled() {
Expand Down

0 comments on commit 8c1933c

Please sign in to comment.