I have a controller that asks an actor before answering and two test cases:
play test the second test failsThe problem is that you are holding a reference to games manager actor ref in a val in an object. The first test that runs will initialise this object, which will get the currently running actor system and lookup the the actor. Then the actor system will be shutdown, and that actor ref will become invalid. But the application controller still holds the invalid ref in the val, so when the next test runs, it uses the invalid actor ref from the shut down actor system.
Here are the ways you can solve it:
gamesManagerRef to a def, use actorFor to look it up, and create it (using actorOf) in Global.onStart. So the actor is created once in Global.onStart, and the lookup is done every time it's used.gamesManagerRef a @volatile var in some other object, and have your Global.onStart method create the actor and then assign it to that var. In this way, the lookup doesn't have to be done each time it's used, but it's kind of ugly because you have this global shared mutable state.Update 23/07/2018: The above suggestions are completely out of date. The recommended approaches are well documented in https://www.playframework.com/documentation/2.6.x/ScalaAkka.