Tom,

Why don't you use a protected factory method (`def createChild: ActorRef = 
...`) in the parent to create your child actor instead of doing it inline? Then 
override it the way you want in the tests. Sometimes good old OO (I know that 
Alan Kay not necessarily meant inheritance when inventing OO) does the trick ;-)

Heiko

On 20 Aug 2014, at 17:00, Tom Sorensen <[email protected]> wrote:

> I've already looked at all the links from 
> https://www.assembla.com/spaces/akka/tickets/3043#/activity/ticket: as well 
> as 
> http://hs.ljungblad.nu/post/69922869833/testing-parent-child-relationships-in-akka
> 
> Still no closer to actually finding a working solution for testing an actor 
> which spawns a child itself. The latter method appears to be the most 
> elegant, but I simply do not understand what is being done in the Bar class 
> with "this", and whether or not it's crucial to the overall implementation. 
> The method using ActorRefFactory as linked from the doc ticket is clear, but 
> it doesn't seem that you can name the Actor being created in this manner, and 
> my use case requires that we be able to do so.
> 
> My actual use case is a FSM that spawns a child actor; for testing I do want 
> to use TestFSMRef in TestKit, but I want to avoid spawning a real child 
> during the test.
> 
> Tom Sorensen
> 
> -- 
> >>>>>>>>>> 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.

-- 
>>>>>>>>>>      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