I am trying to get the same TestActorRef
class NotifySenderTest(_system: ActorSystem) extends TestKit(_system) with ImplicitSender with WordSpecLike with Matchers with BeforeAndAfterAll with BeforeAndAfter {
def this() = this(ActorSystem("NotifySenderTest"))
override def afterAll {
TestKit.shutdownActorSystem(system)
}
"A NotifySender" must {
"be able to process the required messages" in {
val actorRef = TestActorRef[NotifySender] //Line 92
}
}
this actor
class NotifySender extends Actor with Stash {
import Tcp._
import context.system
def receive = {
[...]
}
}
But that leaves me with the next stacktrace
java.lang.NullPointerException: akka.actor.dungeon.Dispatch $class.init(Dispatch.scala: 62) . akka.actor.LocalActorRef. (ActorRef.scala: 304) at akka.testkit.TestActorRef. (TestActorRef.scala: 21) at akka.testkit.TestActorRef $.apply(TestActorRef.scala: 141) at akka.testkit.TestActorRef $.apply(TestActorRef.scala: 137) at akka.testkit.TestActorRef $.apply(TestActorRef.scala: 146) at akka.testkit.TestActorRef $.apply(TestActorRef.scala: 144) at actor.NotifySenderTest $$ anonfun $2 $$ anonfun $ $ $ $4.Apply $ $ (NotifySenderTest.scala: 92) actor.NotifySenderTest $$ anonfun $2 $$ anonfun $ $MCV $ $4.Apply(NotifySenderTest.scala: 91)...
: , - . TestActorRef . , TextActorRefs , Stash, , , . ()
Edit2: . . 2.3. ?!