I don't think it's a matter of my use-case, I think it's a matter of test case granularity. In my system, I throw the Exception because I want the parent to act upon it, so it's part of the actors API. However, I tend to test actors in isolation, i.e., I want to test the child alone and make sure that it acts as expected. When testing the parent, I mock the child where necessary. The reason for that is that I don't want my unit tests to become too complex, which is the case IMO, when testing whole actor hierarchies at once.
But IMHO, when throwing an exception is part of the actors behavior, I think I should be able to test it in isolation, too. best Carsten Am Freitag, 9. Mai 2014 13:07:53 UTC+2 schrieb Konrad Malawski: > > Nothing like that in TestKit, reason being - you don't usually interact > with Actors like that. I think the test should feel more like "when this > happens, will it be restarted by it's parent"? etc. > I'd rather structure the test like that, but maybe there's something I'm > missing in your use-case. > > > On Fri, May 9, 2014 at 12:56 PM, Carsten Saathoff > <[email protected]<javascript:> > > wrote: > >> Hi, >> >> I am currently trying to figure out how to best test whether an actor >> throws an exception. The only solution I can think of is creating that >> actor as a child of another actor and use the standard supervision to >> somehow propagate the exception to the test code (probably there are >> several ways to do it that way). However, that feels somewhat complicated. >> Is there a more elegant way to test it or support in the Testkit that I am >> not able to find? >> >> thanks >> >> Carsten >> >> -- >> >>>>>>>>>> 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] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Cheers, > Konrad 'ktoso' Malawski > hAkker - Typesafe, Inc > > <http://www.scaladays.org/> > -- >>>>>>>>>> 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.
