Package akka.testkit

Examples of akka.testkit.TestProbe.send()


  @Test
  public void mustBeAbleToCreateActorWIthConstructorParams() {
    ActorRef ref = system.actorOf(Props.create(ActorWithConstructorParams.class, "a", "b", new Integer(17), 18));
    final TestProbe probe = new TestProbe(system);
    probe.send(ref, "get");
    probe.expectMsg("a-b-17-18");
  }

  @Test
  public void mustBeAbleToCreateActorWIthBoxedAndUnBoxedConstructorParams() {
View Full Code Here


  @Test
  public void mustBeAbleToCreateActorWIthBoxedAndUnBoxedConstructorParams() {
    ActorRef ref = system.actorOf(Props.create(ActorWithConstructorParams.class, "a", "b", 17, new Integer(18)));
    final TestProbe probe = new TestProbe(system);
    probe.send(ref, "get");
    probe.expectMsg("a-b-17-18");
  }

  @Test
  public void mustBeAbleToCreateActorWIthNullConstructorParams() {
View Full Code Here

  @Test
  public void mustBeAbleToCreateActorWIthNullConstructorParams() {
    ActorRef ref = system.actorOf(Props.create(ActorWithConstructorParams.class, "a", null, null, 18));
    final TestProbe probe = new TestProbe(system);
    probe.send(ref, "get");
    probe.expectMsg("a-null-null-18");
  }

  @Test
  public void mustBeAbleToCreateActorWIthNullConstructorParams2() {
View Full Code Here

  @Test
  public void mustBeAbleToCreateActorWIthNullConstructorParams2() {
    // without this Object array wrapper it will not compile: "reference to create is ambiguous"
    ActorRef ref = system.actorOf(Props.create(ActorWithConstructorParams.class, new Object[] { null }));
    final TestProbe probe = new TestProbe(system);
    probe.send(ref, "get");
    probe.expectMsg("null-undefined-0-0");
  }

  @Test
  public void mustBeAbleToCreateActorWIthNullConstructorParams3() {
View Full Code Here

  @Test
  public void mustBeAbleToCreateActorWIthNullConstructorParams3() {
    ActorRef ref = system.actorOf(Props.create(ActorWithConstructorParams.class, "a", null));
    final TestProbe probe = new TestProbe(system);
    probe.send(ref, "get");
    probe.expectMsg("a-null-0-0");
  }

  public static class ActorWithConstructorParams extends UntypedActor {
View Full Code Here

  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);
  }
View Full Code Here

  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
View Full Code Here

  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() {
View Full Code Here

  @Test
  public void testingWithoutParent() {
    TestProbe probe = new TestProbe(system);
    ActorRef child = system.actorOf(Props.create(DependentChild.class, probe.ref()));
    probe.send(child, "ping");
    probe.expectMsg("pong");
  }

  @Test
  public void testingWithCustomProps() {
View Full Code Here

  public void testingWithCustomProps() {
    TestProbe probe = new TestProbe(system);
    Props childProps = Props.create(MockedChild.class);
    TestActorRef<DependentParent> parent = TestActorRef.create(system, Props.create(DependentParent.class, childProps));

    probe.send(parent, "pingit");

    // test some parent state change
    assertTrue(parent.underlyingActor().ponged == true || parent.underlyingActor().ponged == false);
  }
View Full Code Here

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.