Created
March 8, 2012 22:58
-
-
Save phaller/2003998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.akkatrain | |
import org.junit.runner.RunWith | |
import org.specs2.mutable.Specification | |
import org.specs2.runner.JUnitRunner | |
import akka.util.Duration | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import akka.dispatch.Await | |
@RunWith(classOf[JUnitRunner]) | |
class ActorsSpec extends Specification { | |
"A ComputeActor" should { | |
"respond with the correct results" in { | |
val timeout = Duration(1000, "millis") | |
val sys = ActorSystem() | |
val worker = sys.actorOf(Props[ComputeActor]) | |
val future = worker.ask("hello world")(Timeout(2000)) | |
Await.result(future, timeout).asInstanceOf[Int] must beEqualTo(11) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment