Support for null in mapAsync and fromCompletionStage #25475

This commit is contained in:
mszczygiel 2019-04-16 09:08:05 +02:00 committed by Johan Andrén
parent 549ccb78a6
commit d4813b91c3
9 changed files with 134 additions and 48 deletions

View file

@ -813,6 +813,21 @@ public class FlowTest extends StreamTest {
probe.expectMsgEquals("C");
}
@Test
public void mustBeAbleToUseMapAsyncForFutureWithNullResult() throws Exception {
final Iterable<Integer> input = Arrays.asList(1, 2, 3);
Flow<Integer, Void, NotUsed> flow =
Flow.of(Integer.class).mapAsync(1, x -> CompletableFuture.completedFuture(null));
List<Void> result =
Source.from(input)
.via(flow)
.runWith(Sink.seq(), materializer)
.toCompletableFuture()
.get(3, TimeUnit.SECONDS);
assertEquals(0, result.size());
}
@Test
public void mustBeAbleToUseCollectType() throws Exception {
final TestKit probe = new TestKit(system);