Hi Roland,
Am Freitag, 9. Mai 2014 15:32:30 UTC+2 schrieb rkuhn:
>
> The failure modes of an actor do make sense to view as part of its API, it
> is something the supervisor will have to know about and prepared to handle
> (or escalate). Therefore I agree with the sentiment that it should be
> testable as well. What I use is what I call a StepParent actor that looks
> like this:
>
Yes, after further thinking about it, I also came to the same conclusion.
> class StepParent(target: ActorRef) extends Actor {
> override val supervisorStrategy = OneForOneStrategy() {
> case thr: Throwable => target ! thr; Restart // or make it
> configurable/controllable during the test
> }
> def receive = {
> case p: Props => sender ! context.actorOf(p, "child")
> }
> }
>
> ... // in a test
> val parent = system.actorOf(Props(new StepParent(testActor)), "stepParent")
> parent ! Props(...) // for the actor under test
> val subject = expectMsgType[ActorRef]
> // and now test the subject
>
That's actually very similar to how I tested whether exceptions are thrown.
But I also wondered whether it would be possible to make this more
convenient. For instance some method on TestActorRef that can be used to
check if and what exceptions were thrown. Or are there technical
limitations that this is not supported?
best
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].
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.