Package akka.actor

Source Code of akka.actor.StashJavaAPI

package akka.actor;

import akka.testkit.AkkaJUnitActorSystemResource;
import akka.testkit.TestProbe;

import org.junit.ClassRule;
import org.junit.Test;

public class StashJavaAPI {

  @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"));
  }


}
TOP

Related Classes of akka.actor.StashJavaAPI

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.