From 1064b7fe3ff8c45cf0eee92d4e5bd5d45b37e0fc Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Tue, 23 Jan 2018 16:53:40 +0100 Subject: [PATCH] use `expectTerminated` --- .../src/test/scala/akka/actor/typed/WatchSpec.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/akka-actor-typed-tests/src/test/scala/akka/actor/typed/WatchSpec.scala b/akka-actor-typed-tests/src/test/scala/akka/actor/typed/WatchSpec.scala index f39ac9a268..d4a2046632 100644 --- a/akka-actor-typed-tests/src/test/scala/akka/actor/typed/WatchSpec.scala +++ b/akka-actor-typed-tests/src/test/scala/akka/actor/typed/WatchSpec.scala @@ -10,6 +10,7 @@ import akka.testkit.EventFilter import akka.testkit.typed.scaladsl.TestProbe import scala.concurrent._ +import scala.concurrent.duration._ import akka.testkit.typed.TestKit import com.typesafe.config.ConfigFactory @@ -171,7 +172,6 @@ class WatchSpec extends TestKit("WordSpec", WatchSpec.config) class ErrorTestSetup { val terminator = systemActor(terminatorBehavior) private val stopProbe = TestProbe[Done]() - def expectStopped(): Unit = stopProbe.expectMsg(Done) val watcher = systemActor( Behaviors.supervise( @@ -186,11 +186,12 @@ class WatchSpec extends TestKit("WordSpec", WatchSpec.config) Behaviors.stopped }.onSignal { case (_, PostStop) ⇒ - stopProbe.ref ! Done Behaviors.stopped } ).onFailure[Throwable](SupervisorStrategy.stop) ) + + def expectStopped(): Unit = stopProbe.expectTerminated(watcher, 1.second) } "fail when watch is used after watchWith on same subject" in new ErrorTestSetup {