36 lines
858 B
Scala
36 lines
858 B
Scala
/**
|
|
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
|
|
*/
|
|
package docs.testkit
|
|
|
|
//#plain-spec
|
|
import akka.actor.ActorSystem
|
|
import akka.actor.Actor
|
|
import akka.actor.Props
|
|
import akka.testkit.{ TestActors, TestKit, ImplicitSender }
|
|
import org.scalatest.WordSpecLike
|
|
import org.scalatest.Matchers
|
|
import org.scalatest.BeforeAndAfterAll
|
|
|
|
//#implicit-sender
|
|
class MySpec(_system: ActorSystem) extends TestKit(_system) with ImplicitSender
|
|
with WordSpecLike with Matchers with BeforeAndAfterAll {
|
|
//#implicit-sender
|
|
|
|
def this() = this(ActorSystem("MySpec"))
|
|
|
|
override def afterAll {
|
|
TestKit.shutdownActorSystem(system)
|
|
}
|
|
|
|
"An Echo actor" must {
|
|
|
|
"send back messages unchanged" in {
|
|
val echo = system.actorOf(TestActors.echoActorProps)
|
|
echo ! "hello world"
|
|
expectMsg("hello world")
|
|
}
|
|
|
|
}
|
|
}
|
|
//#plain-spec
|