import akka.actor.ActorSystem;
import akka.actor.testkit.typed.javadsl.TestKitJunitResource;
import akka.actor.testkit.typed.javadsl.TestProbe;
import org.junit.ClassRule;
import org.junit.Test;
public class MyActorTest {
@ClassRule
public static final TestKitJunitResource testKit = new TestKitJunitResource();
@Test
public void testMyActor() {
TestProbe<MyActor.Reponse> probe = testKit.createTestProbe(MyActor.Response.class);
ActorSystem<MyActor.Command> actorSystem = testKit.system();
ActorRef<MyActor.Command> myActor = actorSystem.spawn(MyActor.create(), "myActor");
myActor.tell(new MyActor.Request("test"), probe.getRef());
probe.expectMessage(new MyActor.Response("test_response"));
}
}