I'm trying to check if an actor was completed or not, I know there is a way to check if it was completed using TestProbe expectTerminated
http://doc.akka.io/docs/akka/2.4.16/scala/testing.html#Watching_Other_Actors_from_Probes
But is there a way to check the opposite?
Thank:)
Update
In my scenario, I have a custom actor that has one or more child actors, and it will stop when all its children are disconnected (completed).
The behavior works fine, but my problem is that I can only test the script in which it has no children, and finish it myself. I cannot find the right statement to verify that it is not completed if he still has children.
Here's a simplified test version:
"Terminates itself if there are no connected clients" in {
val userActor = system.ActorOf(UserActor.props())
userActor ! UserActor.ClientDisconnected()
val deathWatch = TestProbe()
deathWatch.watch(userActor)
deathWatch.expectTerminated(userActor, timeoutDuration)
}
"Not Terminates itself when there are still other clients connected" in {
val userActor = system.ActorOf(UserActor.props())
userActor ! UserActor.ClientConnected(sessionId, accessToken)
userActor ! UserActor.ClientDisconnected()
}