title: sender() results in deadLetters for implementation but not in unit tests
body: <p>I'm working with Akka classic actors (running in Play framework) and am running into a problem with the <code>sender()</code> method. When I build and run the code (using <code>sbt run</code>), I can see that <code>sender()</code> resolves to <code>deadLetters</code> actor. However, when running unit tests for that actor, <code>sender()</code> resolves to the correct ActorRef (even though it shouldn't).</p>
  <p>The <code>sender()</code> is being invoked from within a closing future which is why I'm seeing the <code>deadLetters</code> when running the actual implementation. However, for some reason, I'm not seeing the <code>deadLetters</code> in the unit tests. Any ideas to why there is a difference of behavior between the unittests and running instance?</p>
  <p><strong>Some sample code to give an idea of the code structure</strong></p>
  <pre><code>class MyActor extends Actor {
    private def throwError() = {
      // THIS IS WHERE sender() BEHAVIOR DIFFERENTIATES BETWEEN IMPLEMENTATION AND UNITTESTS
      sender() ! MyErrorMessage()
  
      throw new Exception()
    }
  
    private def myFutureMethod(args: SomeType): Future[Done] = {
      for {
         Some logic here...
      } yield {
        if (some logic check...)
          throwError()
        else
          Done
      }
    }
  
    override def stepReceive = {
      case MyMessage(args) =&gt; 
        myFutureMethod(args)
    }
  }
  
  </code></pre>
  <p><strong>Some sample code to give an idea of the unittest structure</strong></p>
  <pre><code>  &quot;My failure test case&quot; in {
      val testProbe = TestProbe()
  
      myActorImpl.tell(MyMessage(args), testProbe)
  
      // testProbe SHOULD BE NOT BE RECEIVING A MESSAGE BASED ON THE ABOVE
      // IMPLEMENTATION, BUT IT DOES.
      testProbe.expectNoMessage()
    }
  </code></pre>
  <p>If anyone has some tips or ideas for debugging, that would be awesome. Thanks.</p>