I'm using AkkaTestFramework with Akka typed, and I cannot find a way to create an ActorSystem mock for one of my typed Actor.
I found this way
val pinger: ActorRefTyped[ItAssetRequest] = testKit.spawn(ItAsset(), "itAssetMock")
But this ActorRefTyped
does not contain a schedule
which I need internally in my class to use ask pattern
In my class where I receive this ActorSystem
class RegisterConsumerStream(itAsset: ActorSystemTyped[ItAssetRequest]){
implicit val schedule: typed.Scheduler = itAsset.scheduler
itAsset ? (ref => ItAssetRequest(connectorState, ref)
}
If I pass a ActorRefTyped[ItAssetRequest]
there's no schedule so I cannot use the ask pattern since it needs the schedule implicit.
Any idea?
You are creating an Actor with testKit.spawn method not an ActorSystem. With the Akka TestKit you already have available an ActorSystem inside your tests:
With the spawn method from the testKit you create an actor for testing your behaviors not an actor system.