Fixed the failing doc test
This commit is contained in:
parent
9a7b9d7ab9
commit
c43b024cac
1 changed files with 11 additions and 5 deletions
|
|
@ -37,6 +37,12 @@ case class Message(s: String)
|
|||
class FirstActor extends Actor {
|
||||
val myActor = context.actorOf(Props[MyActor], name = "myactor")
|
||||
//#context-actorOf
|
||||
def receive = {
|
||||
case x ⇒ sender ! x
|
||||
}
|
||||
}
|
||||
|
||||
class AnonymousActor extends Actor {
|
||||
//#anonymous-actor
|
||||
def receive = {
|
||||
case m: DoIt ⇒
|
||||
|
|
@ -233,27 +239,27 @@ class ActorDocSpec extends AkkaSpec(Map("akka.loglevel" -> "INFO")) {
|
|||
system.stop(myActor)
|
||||
}
|
||||
|
||||
"using implicit timeout" taggedAs TimingTest in {
|
||||
"using implicit timeout" in {
|
||||
val myActor = system.actorOf(Props(new FirstActor))
|
||||
//#using-implicit-timeout
|
||||
import akka.util.duration._
|
||||
import akka.util.Timeout
|
||||
import akka.pattern.ask
|
||||
implicit val timeout = Timeout(500 millis)
|
||||
implicit val timeout = Timeout(5 seconds)
|
||||
val future = myActor ? "hello"
|
||||
//#using-implicit-timeout
|
||||
Await.result(future, timeout.duration) must be("hello")
|
||||
|
||||
}
|
||||
|
||||
"using explicit timeout" taggedAs TimingTest in {
|
||||
"using explicit timeout" in {
|
||||
val myActor = system.actorOf(Props(new FirstActor))
|
||||
//#using-explicit-timeout
|
||||
import akka.util.duration._
|
||||
import akka.pattern.ask
|
||||
val future = myActor.ask("hello")(500 millis)
|
||||
val future = myActor.ask("hello")(5 seconds)
|
||||
//#using-explicit-timeout
|
||||
Await.result(future, 500 millis) must be("hello")
|
||||
Await.result(future, 5 seconds) must be("hello")
|
||||
}
|
||||
|
||||
"using receiveTimeout" in {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue