You're right this is very restrictive is using `expectEffect`

You can use `retrieveEffect` and use whatever testing framework you use to
assert against it.

We did discuss adding expectX for each type of effect e.g. expectSpawned
where we could just take the name rather than the behavior.

We could also add a expectEffect with a type param for the effect type like
we do for test probes to make the first suggestion cleaner. WDYT?

Cheers
Christopher


On Fri, Mar 9, 2018 at 8:35 AM, Nishant Vishwakarma <nishant...@gmail.com>
wrote:

> Hi All,
>
> We are trying to test *Spawned* *Effect* in a Akka Typed actor using
> *BehaviorTestKit*
>
> Consider a Behavior representing a child actor as below
>
> object ChildBehaviorFactory {
>   def make[T](someFactory: SomeFactory): Behavior[ChildMessage] =
>     Behaviors.mutable[ChildMessage](ctx ⇒ new ChildBehavior(ctx,
> someFactory))
> }
>
> Consider a Parent Actor which spawns the above actor as below
>
> class ParentBehavior extends Behaviors.MutableBehavior[MyParent] {
>  ...
>   ctx.spawn(ChildBehaviorFactory.make(someFactory), "ChildActor")
>  ...
> }
>
> If we try to assert on the Spawned effect obtained for Parent behavior
> against
>
> Spawned(ChildBehaviorFactory.make(someFactory), "ChildActor")
>
> The test fails because the behavior created in the test is different than
> the one created inside the parent.
>
> Notably, this is different than the Spawned effect present in the earlier
> Akka version where it only expected the name of actor spawned which worked
> fine.
>
> We looked at the tests present in the Akka code base as well where the
> behaviors were created as a *val  *and was accessible in the test as well
> as the behavior under test. But this looks very restrictive.
>
> Is there any way to work around this?
>
> Thanks and Regards,
> Nishant
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to