Created
April 18, 2017 13:11
-
-
Save anonymous/db44ab68dc45ac03beb5045b0d912092 to your computer and use it in GitHub Desktop.
the description for this gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// what we want to test: | |
val flowUnderTest = Flow[Int].map(n => n * n) | |
// source and sink probes are returned as materialized values: | |
val (source, sink) = TestSource.probe[Int] | |
.via(flowUnderTest) | |
.toMat(TestSink.probe)(Keep.both) | |
.run() | |
// now we can use source and sink to | |
source.sendNext(3) | |
sink.requestNext(9) | |
source.sendComplete() | |
sink.expectComplete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment