title: Why does the Identify message find an actor in an actor selection after its termination?
body: <p>Within a test-program, I want to check that an Actor (<code>child</code>) remains terminated and is not created again after some computation. My test looks like (it is part of a TestKit subclass):</p>
  
  <pre><code>val childSelection = system.actorSelection(parent.path / "*")
  childSelection ! Identify(0)
  val child = expectMsgPF {
    case ActorIdentity(0, Some(ref)) =&gt; ref
  }
  watch(child)
  // some computation that should end in stopping child
  expectTermiated(child)
  // some computation that should not create a new child
  childSelection ! Identify(1)
  expectMsg(ActorIdentity(1, None))
  </code></pre>
  
  <p>The last line sometimes unexpectedly fails, stating that the message ActorIdentity(1, Some(<em>parent.path/child-name</em>)) was received instead of the expected one. This means that, even after receiving the Terminated message (resulting from the <code>expectTerminated(...)</code> test), sending the Identify message to an actor selection does not necessarily result in the ActorIdentity(..., None) response.</p>
  
  <p>Does anybody know what the akka framework actually does and how it works in this case? Thanks in advance for your help!</p>
  
  <p>Meanwhile, I replaced the last line of my test with:</p>
  
  <pre><code>val identities = receiveWhile() {
    case ActorIdentity(1, Some(ref)) =&gt; ref == child
  }
  if (identities.isEmpty) {
    expectMsg(ActorIdentity(1, None))
  } else {
    expectNoMsg
  }
  </code></pre>
  
  <p>which seems to work fine but is quite more complex to read (and write)...</p>