I have the following actor
import akka.actor.AbstractActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;
public class MyActor extends AbstractActor {
private final LoggingAdapter log = Logging.getLogger(getContext().getSystem(), this);
@Override
public Receive createReceive() {
return receiveBuilder()
.match(String.class, s -> {
log.info("Received String message: {}", s);
doSomethingNow();
})
.matchAny(o -> log.info("received unknown message"))
.build();
}
private MyObject doSomethingNow() {
/// code
return MyObject;
}
Now to unit test this actor, should I mock the method 'doSomethingNow'? From the PowerMockito doc, it looks like I also need to mock the class which is the actor but the TestKit already offers a framework around mocking actors, whats the right way to test this actor?