2011-10-10 11:12:34 +02:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
|
|
|
|
package akka.testkit
|
|
|
|
|
|
|
|
|
|
import org.scalatest.WordSpec
|
|
|
|
|
import org.scalatest.matchers.MustMatchers
|
|
|
|
|
import akka.AkkaApplication
|
2011-10-10 15:45:55 +02:00
|
|
|
import akka.actor.{ Actor, ActorRef, Props }
|
2011-10-10 11:12:34 +02:00
|
|
|
|
|
|
|
|
abstract class AkkaSpec(_application: AkkaApplication = AkkaApplication())
|
|
|
|
|
extends TestKit(_application) with WordSpec with MustMatchers {
|
|
|
|
|
|
2011-10-10 15:45:55 +02:00
|
|
|
def app = _application
|
|
|
|
|
|
|
|
|
|
def actorOf(props: Props): ActorRef = app.createActor(props)
|
|
|
|
|
|
|
|
|
|
def actorOf[T <: Actor](clazz: Class[T]): ActorRef = actorOf(Props(clazz))
|
|
|
|
|
|
|
|
|
|
def actorOf[T <: Actor: Manifest]: ActorRef = actorOf(manifest[T].erasure.asInstanceOf[Class[_ <: Actor]])
|
|
|
|
|
|
|
|
|
|
def actorOf[T <: Actor](factory: ⇒ T): ActorRef = actorOf(Props(factory))
|
2011-10-10 11:12:34 +02:00
|
|
|
}
|