Skip to content

Instantly share code, notes, and snippets.

Created April 18, 2017 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/db44ab68dc45ac03beb5045b0d912092 to your computer and use it in GitHub Desktop.
Save anonymous/db44ab68dc45ac03beb5045b0d912092 to your computer and use it in GitHub Desktop.
the description for this gist
// 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