Problem: you have an Akka Actor with constructor arguments and you want to use require to perform argument verification (such as not null or any boolean validation). Then you want to test these assertions. When you run the test you can see the ActorSystem generating the exceptions and terminating with an ActorInitializationException complete with stack trace on your console but you can't seem to capture the exception for verification to pass your unit test.

The solution is probably in the docs somewhere but I couldn't seem to find it. Fortunately its pretty easy. Here I have an actor:

class StatsActor(val address: InetSocketAddress) extends Actor {  
    require(address != null)

And here's how to test it (in Specs2/ScalaTest WordSpec format):

    "initialized with a null address" should {
      "throw an exception" in new Environment {
        val probe = TestProbe()
        probe watch system.actorOf(StatsActor.props(null))
        probe expectMsgClass classOf[Terminated]

Solution from StackOverflow. I really like the EventListener approach but I haven't given it a shot yet as the TestProbe met my needs with the least amount of code.