I have three actors in My Project Lets Consider A,B,C
A will send message to B actor and B actor will do some action and creates ActorRef for C actor and then C actor will send a message to Sender actor in our scenario which is B actor and once B actor receives the response from C actor It’ll do some action and sends final response To A actor.
In Actor A :
b=System.actorOf(Props[B])
b ! messageFromA(aActorRef)
In Actor B:
case messageFromA(x:ActorRef)=>
val x=methodInB1()
cActorRef ! x
case messageFromC(responseFromC)=>
methodB2()
In Actor C:
case x=>sender ! messageFromC(responseFromC)
In the above code, you can clearly see that the Actor B is following some flow and not replying directly to senders. I need how to write the unit test case for this Actor B with full coverage. How to Implement can someone please suggest.
For Both the messages in Actor B it’s not replying to any message and Instead, it perform some action and calling other actors,so we cannot expect the direct reply for any message while writing the test case .