Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.