Skip to content

Instantly share code, notes, and snippets.

@henrikengstrom
Created March 29, 2012 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrikengstrom/2239565 to your computer and use it in GitHub Desktop.
Save henrikengstrom/2239565 to your computer and use it in GitHub Desktop.
Using specific config settings with TestActorRef
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