I am trying to use the typed scala test kit and have a command as follows:
final case class Available (replyTo: ActorRef[StatusReply[Producer.Command]]) extends Command
I want top send this message in a test and do so according to the examples:
val consumer: ActorRef[Producer.Command] = testKit.spawn(behavior, Consumer.ID, dispatcher)
consumer ! Consumer.Available(consumer)
But I get the error:
[error] 58 | consumer ! Consumer.Available(consumer)
[error] | ^^^^^^^^
[error] |Found: (consumer : akka.actor.typed.ActorRef[concurrency.Producer.Command])
[error] |Required: akka.actor.typed.ActorRef[akka.pattern.StatusReply[concurrency.Producer.Command]
[error] | ]
[error] one error found
How can I generate and send such a message? In the original code I use a:
ctx: ActorContext[Producer.Command] = ...
ctx.askWithStatus(...)
How can I convert the standard type:
ActorRef[AType.Command]
into a:
ActorRef[akka.pattern.StatusReply[AType.Command] ]
Note that I cannot use the original method because I have no way of referencing an ActorContext
TIA