!tes #2971 Make TestKit.remaining throw AssertionError outside of within

This commit is contained in:
dario.rexin 2014-03-11 11:23:12 +01:00
parent dfef14a590
commit 826cc74de3
41 changed files with 156 additions and 120 deletions

View file

@ -44,8 +44,8 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
"complete Future with AskTimeoutException when actor not terminated within timeout" in {
val target = system.actorOf(Props[TargetActor])
val latch = TestLatch()
target ! ((latch, remaining))
intercept[AskTimeoutException] { Await.result(gracefulStop(target, 500 millis), remaining) }
target ! ((latch, remainingOrDefault))
intercept[AskTimeoutException] { Await.result(gracefulStop(target, 500 millis), remainingOrDefault) }
latch.open()
}
}
@ -56,7 +56,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.successful(5).future)
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
Await.result(r, remaining) should be(5)
Await.result(r, remainingOrDefault) should be(5)
}
"be completed abnormally eventually" in {
@ -64,7 +64,7 @@ class PatternSpec extends AkkaSpec("akka.actor.serialize-messages = off") {
val f = akka.pattern.after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")).future)
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
intercept[IllegalStateException] { Await.result(r, remaining) }.getMessage should be("Mexico")
intercept[IllegalStateException] { Await.result(r, remainingOrDefault) }.getMessage should be("Mexico")
}
}
}