title: Akka: testing actor got message
body: <p>I have the next code:</p>
  
  <pre><code>//TestActor got some message  
  class TestActor extends Actor {
  
    def receive = {
      case string: String =&gt; //.... 
    }
  }
  //TestReg when create get ActorRef, when i call `pass` method, then should pass text to ActorRef
  class TestReg(val actorRef: ActorRef) {
    def pass(text: String) {
     actorRef ! text
    }
  }
  </code></pre>
  
  <p>When i wrote test:</p>
  
  <pre><code>class TestActorReg extends TestKit(ActorSystem("system")) with ImplicitSender
     with FlatSpecLike with MustMatchers with BeforeAndAfterAll {
  
     override def afterAll() {
       system.shutdown()
     }
  
     "actorReg" should "pass text to actorRef" in {
        val probe = TestProbe()
  
        val testActor = system.actorOf(Props[TestActor])
  
        probe watch testActor
  
        val testReg = new TestReg(testActor)
        testReg.pass("test")
  
        probe.expectMsg("test")
     }
  }
  </code></pre>
  
  <p>I got error:</p>
  
  <pre><code>java.lang.AssertionError: assertion failed: timeout (3 seconds) during expectMsg while waiting for test
  </code></pre>
  
  <p>How to check what the actor got a text?</p>