Hi Urs,

you can use isAlive 
<https://doc.akka.io/api/akka/current/akka/actor/testkit/typed/scaladsl/BehaviorTestKit.html#isAlive:Boolean>
 to check whether the behavior in the BehaviorTestKit has terminated or not. 
You’ll have to manually feed the actor the "terminated" message (making the 
test timing-independent as a bonus), then you can check for termination.

Regards,

Roland

> 2 jan. 2020 kl. 16:12 skrev Urs Peter <[email protected]>:
> 
> Answering part of my own question: 
> 
> I figured out how to watch termination of a typed actor, relying on the 
> classic converters which requires the following import import 
> akka.actor.typed.scaladsl.adapter._:
> 
> "!!! terminate typed actor with ActorTestKit - that's how !!!" in {
>   import akka.actor.typed.scaladsl.adapter._
>   val actorTestKit = ActorTestKit()
>   implicit val classicActorSystem = actorTestKit.system.toClassic
>   val probe = TestProbe()
>   val timeout = actorTestKit.spawn(timeoutBehavior)
>   probe.watch(timeout.toClassic)
>   probe.expectTerminated(timeout.toClassic)
> }
> 
> I assume that's the way to go. If not please let me know. 
> 
> Concerning the BehaviorTestKit approach I would still look for an answer.
>  "??? terminate typed actor with BehaviorTestKit - but how ???" in {
>       val behaviorTestKit = BehaviorTestKit.create(timeoutBehavior)
>       //works ...
>       behaviorTestKit.expectEffect(ReceiveTimeoutSet(500 millis, 
> "terminated"))
>       //...but how to intercept the actual termination (-> Stopped) without 
> sending a message???
> 
> 
>     }
> 
> 
> 
> -- 
> *****************************************************************************************************
> ** New discussion forum: https://discuss.akka.io/ replacing akka-user 
> google-group soon.
> ** This group will soon be put into read-only mode, and replaced by 
> discuss.akka.io
> ** More details: 
> https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
> *****************************************************************************************************
> >>>>>>>>>> 
> >>>>>>>>>> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/akka-user/936b3f29-1a25-42d3-85f5-e8a68179cfd9%40googlegroups.com.

-- 
*****************************************************************************************************
** New discussion forum: https://discuss.akka.io/ replacing akka-user 
google-group soon.
** This group will soon be put into read-only mode, and replaced by 
discuss.akka.io
** More details: https://akka.io/blog/news/2018/03/13/discuss.akka.io-announced
*****************************************************************************************************
>>>>>>>>>> 
>>>>>>>>>>      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 view this discussion on the web visit 
https://groups.google.com/d/msgid/akka-user/6A374FA2-FF2A-4547-ACBF-AA3E17F24450%40rkuhn.info.

Reply via email to