Created
March 29, 2012 16:35
-
-
Save henrikengstrom/2239565 to your computer and use it in GitHub Desktop.
Using specific config settings with TestActorRef
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
import akka.testkit.TestActorRef | |
import org.scalatest.matchers.MustMatchers | |
import org.scalatest.WordSpec | |
import com.typesafe.config.ConfigFactory | |
import akka.actor.{Actor, ActorSystem} | |
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) | |
class Example2 extends WordSpec with MustMatchers { | |
implicit val actorSystem = ActorSystem("TestSystem", ConfigFactory.parseString("""{ test.value = "Hey, it works!" }""")) | |
"TestKit" must { | |
"allow for specific values in actor systems" in { | |
val theActor = TestActorRef[TestActor2] | |
theActor ! "test" | |
} | |
} | |
} | |
class TestActor2 extends Actor { | |
def receive = { | |
case _ => println(">>> Status: " + context.system.settings.config.getString("test.value")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment