Partial work + broken commit

This commit is contained in:
Viktor Klang 2012-07-04 15:25:30 +02:00
parent 3911b18069
commit 52d33113d9
50 changed files with 228 additions and 1092 deletions

View file

@ -8,10 +8,9 @@ import language.postfixOps
import akka.testkit.AkkaSpec
import akka.actor.{ Props, Actor }
import scala.concurrent.Await
import scala.concurrent.{ Future, Promise, Await }
import scala.concurrent.util.Duration
import scala.concurrent.util.duration._
import akka.dispatch.{ Future, Promise }
object PatternSpec {
case class Work(duration: Duration)
@ -50,16 +49,16 @@ class PatternSpec extends AkkaSpec {
"pattern.after" must {
"be completed successfully eventually" in {
val f = after(1 second, using = system.scheduler)(Promise.successful(5))
val f = after(1 second, using = system.scheduler)(Promise.successful(5).future)
val r = Future.firstCompletedOf(Seq(Promise[Int](), f))
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
Await.result(r, remaining) must be(5)
}
"be completed abnormally eventually" in {
val f = after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")))
val f = after(1 second, using = system.scheduler)(Promise.failed(new IllegalStateException("Mexico")).future)
val r = Future.firstCompletedOf(Seq(Promise[Int](), f))
val r = Future.firstCompletedOf(Seq(Promise[Int]().future, f))
intercept[IllegalStateException] { Await.result(r, remaining) }.getMessage must be("Mexico")
}
}