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