19452: Contramap and fromFunction

This commit is contained in:
Alois Cochard 2016-02-10 12:18:24 +01:00 committed by Endre Sándor Varga
parent d9b47c3a8d
commit 6c69fba61e
8 changed files with 71 additions and 3 deletions

View file

@ -803,6 +803,15 @@ public class FlowTest extends StreamTest {
assertEquals((Object) 0, result);
}
@Test
public void shouldBePossibleToCreateFromFunction() throws Exception {
List<Integer> out = Source.range(0, 2).via(Flow.fromFunction((Integer x) -> x + 1))
.runWith(Sink.seq(), materializer).toCompletableFuture().get(3, TimeUnit.SECONDS);
assertEquals(Arrays.asList(1, 2, 3), out);
}
public void mustSuitablyOverrideAttributeHandlingMethods() {
@SuppressWarnings("unused")
final Flow<Integer, Integer, NotUsed> f =