From 1a717c02cac2e0535bdd31ccf9b503fa7d504a88 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Thu, 1 Feb 2018 16:17:14 +0100 Subject: [PATCH] =typ fix race condition in AskSpec --- .../src/test/scala/akka/actor/typed/AskSpec.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/akka-actor-typed-tests/src/test/scala/akka/actor/typed/AskSpec.scala b/akka-actor-typed-tests/src/test/scala/akka/actor/typed/AskSpec.scala index 70df741fb1..bec60e5213 100644 --- a/akka-actor-typed-tests/src/test/scala/akka/actor/typed/AskSpec.scala +++ b/akka-actor-typed-tests/src/test/scala/akka/actor/typed/AskSpec.scala @@ -9,6 +9,7 @@ import akka.actor.typed.scaladsl.Behaviors import akka.actor.typed.scaladsl.Behaviors._ import akka.actor.typed.scaladsl.adapter._ import akka.testkit.typed.TestKit +import akka.testkit.typed.scaladsl.TestProbe import akka.util.Timeout import org.scalatest.concurrent.ScalaFutures @@ -41,6 +42,8 @@ class AskSpec extends TestKit("AskSpec") with TypedAkkaSpec with ScalaFutures { "must fail the future if the actor is already terminated" in { val ref = spawn(behavior) (ref ? Stop).futureValue + val probe = TestProbe() + probe.expectTerminated(ref, probe.remainingOrDefault) val answer = ref ? Foo("bar") val result = answer.failed.futureValue result shouldBe a[TimeoutException]