pekko/akka-actor-tests/src/test/java/akka/actor/StashJavaAPI.java
Seth Tisue fc23f03031 upgrade to latest ScalaTest (#26387)
stuff moved to a new package. you wouldn't expect that in a point
release, but they put type aliases in place so Scala users wouldn't
notice. but the change is visible to Java code.

the upgrade is not strictly necessary, but it would be convenient
for the Scala 2.13 community build to have this merged, so I don't
have to maintain these changes in our Akka fork
2019-02-17 19:45:39 +00:00

47 lines
1.3 KiB
Java

/*
* Copyright (C) 2018-2019 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.actor;
import akka.testkit.AkkaJUnitActorSystemResource;
import akka.testkit.TestProbe;
import org.junit.ClassRule;
import org.junit.Test;
import org.scalatestplus.junit.JUnitSuite;
public class StashJavaAPI extends JUnitSuite {
@ClassRule
public static AkkaJUnitActorSystemResource actorSystemResource =
new AkkaJUnitActorSystemResource("StashJavaAPI", ActorWithBoundedStashSpec.testConf());
private final ActorSystem system = actorSystemResource.getSystem();
private void testAStashApi(Props props) {
ActorRef ref = system.actorOf(props);
final TestProbe probe = new TestProbe(system);
probe.send(ref, "Hello");
probe.send(ref, "Hello2");
probe.send(ref, "Hello12");
probe.expectMsg(5);
}
@Test
public void mustBeAbleToUseStash() {
testAStashApi(Props.create(StashJavaAPITestActors.WithStash.class));
}
@Test
public void mustBeAbleToUseUnboundedStash() {
testAStashApi(Props.create(StashJavaAPITestActors.WithUnboundedStash.class));
}
@Test
public void mustBeAbleToUseUnrestrictedStash() {
testAStashApi(
Props.create(StashJavaAPITestActors.WithUnrestrictedStash.class)
.withMailbox("akka.actor.mailbox.unbounded-deque-based"));
}
}