=str #17089 stream testkit

This commit is contained in:
Martynas Mickevičius 2015-04-24 11:45:03 +03:00
parent 7b4a640147
commit 8e2cc3e70f
96 changed files with 1411 additions and 1131 deletions

View file

@ -0,0 +1,38 @@
/**
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
*/
package docs.stream
import akka.stream._
import akka.stream.scaladsl._
import akka.stream.testkit._
import akka.stream.testkit.scaladsl._
class StreamTestKitDocSpec extends AkkaSpec {
implicit val mat = ActorFlowMaterializer()
"test source probe" in {
//#test-source-probe
TestSource.probe[Int]
.toMat(Sink.cancelled)(Keep.left)
.run()
.expectCancellation()
//#test-source-probe
}
"test sink probe" in {
//#test-sink-probe
Source(1 to 4)
.filter(_ % 2 == 0)
.map(_ * 2)
.runWith(TestSink.probe[Int])
.request(2)
.expectNext(4, 8)
.expectComplete()
//#test-sink-probe
}
}