From 3193eb8009258684c94fd712abed991088df8848 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Wed, 7 Oct 2015 20:00:53 +0200 Subject: [PATCH] +stk add TestSubscriber/Publisher.Probe.ensureSubscription to allow manual initialization Otherwise, it is not possible to use `expectNoMsg()` as the first operation. --- .../src/main/scala/akka/stream/testkit/StreamTestKit.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/akka-stream-testkit/src/main/scala/akka/stream/testkit/StreamTestKit.scala b/akka-stream-testkit/src/main/scala/akka/stream/testkit/StreamTestKit.scala index 39eb3c3a11..e3b1d41545 100644 --- a/akka-stream-testkit/src/main/scala/akka/stream/testkit/StreamTestKit.scala +++ b/akka-stream-testkit/src/main/scala/akka/stream/testkit/StreamTestKit.scala @@ -137,6 +137,9 @@ object TestPublisher { private var pendingRequests = initialPendingRequests private lazy val subscription = expectSubscription() + /** Asserts that a subscription has been received or will be received */ + def ensureSubscription(): Unit = subscription // initializes lazy val + /** * Current pending requests. */ @@ -558,6 +561,9 @@ object TestSubscriber { private lazy val subscription = expectSubscription() + /** Asserts that a subscription has been received or will be received */ + def ensureSubscription(): Unit = subscription // initializes lazy val + def request(n: Long): Self = { subscription.request(n) this