diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala index 8048526f2a..f8aa76a7ca 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/FutureSpec.scala @@ -49,17 +49,16 @@ class FutureSpec extends AkkaSpec with Checkers with BeforeAndAfterAll with Defa "never completed" must { behave like emptyFuture(_(Promise())) "return supplied value on timeout" in { - val f = new RuntimeException("br0ken") + val failure = Promise.failed[String](new RuntimeException("br0ken")) + val otherFailure = Promise.failed[String](new RuntimeException("last")) + val empty = Promise[String]() val timedOut = Promise.successful[String]("Timedout") - val promise1 = Promise.failed[String](f) or timedOut - val promise2 = timedOut or Promise[String]() - val promise3 = Promise.failed[String](f) or Promise.failed[String](f) or timedOut - val promise4 = Promise.failed[String](f) or Promise.failed[String](new RuntimeException("last")) - Await.result(promise1, timeout.duration) must be("Timedout") - Await.result(promise2, timeout.duration) must be("Timedout") - Await.result(promise3, timeout.duration) must be("Timedout") + + Await.result(failure or timedOut, timeout.duration) must be("Timedout") + Await.result(timedOut or empty, timeout.duration) must be("Timedout") + Await.result(failure or failure or timedOut, timeout.duration) must be("Timedout") intercept[RuntimeException] { - Await.result(promise4, timeout.duration) + Await.result(failure or otherFailure, timeout.duration) }.getMessage must be("last") } }