Lookup generally is an anti-pattern and also in Akka – except for remoting and 
testing – there is absolutely no need to use lookup via `actorSelection`. 
Either inject the `ActorRef` to B in the constructor of A or send a message to 
A with the `ActorRef` to B.

Heiko

--

Heiko Seeberger
Home: heikoseeberger.de <http://heikoseeberger.de/>
Twitter: @hseeberger <https://twitter.com/hseeberger>
Public key: keybase.io/hseeberger <https://keybase.io/hseeberger>
> On 13 Sep 2015, at 23:23, Rafael Pacheco <[email protected]> wrote:
> 
> Today I posted this question on StackOverflow, maybe someone can help me.
> I have searched a lot about this and yet have no answer.
> 
> 
> 
> http://stackoverflow.com/questions/32551674/how-to-mock-a-actor-based-on-actorselection
> 
> 
> 
> I have a Actor "A" (user/A) that send message "X" for a other actor "B" 
> (user/B) when receive a message "M". To do this the actor A use 
> ActorSelection I need test that when I send M to A, B will receive "X".
> 
> 
> 
> I try this approachs:
> 
> 
> 
> * I used TestProbe and JavaTestKit on "user/B" but have not success.
> 
> * I also see some similar questions about this but every answer said to use 
> ActorRef insted of ActorSelection. This is not a option for me, I realy need 
> use a ActorSelection.
> 
> 
> 
> Someone have some idea ?
> 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <https://groups.google.com/group/akka-user>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to