chore: Add collect operator test for stream javadsl. (#963)

This commit is contained in:
He-Pin(kerr) 2024-01-16 10:13:29 +08:00 committed by GitHub
parent 7c82c2a1c4
commit d313eef0a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -948,6 +948,20 @@ public class FlowTest extends StreamTest {
probe.expectMsgEquals("2C");
}
@Test
public void mustBeAbleToUseCollect() {
Source.from(Arrays.asList(1, 2, 3, 4, 5))
.collect(
PFBuilder.<Integer, Integer>create()
.match(Integer.class, elem -> elem % 2 != 0, elem -> elem)
.build())
.runWith(TestSink.create(system), system)
.ensureSubscription()
.request(5)
.expectNext(1, 3, 5)
.expectComplete();
}
@Test
public void mustBeAbleToUseCollectType() throws Exception {
final TestKit probe = new TestKit(system);