@Test public void testLeaveKill() throws Exception { new JavaTestKit(system) { { final Props props = LobbyBalancerActor.props(configuration, 0, 2); final TestActorRef<LobbyBalancerActor> subject = TestActorRef.create(system, props, "testB"); final Join req = new Join(team, getRef()); final JavaTestKit probe = new JavaTestKit(system); final User snd = new User(UUID.randomUUID(), new Credentials("test", "test")); subject.tell(new Join(team, probe.getRef()), probe.getRef()); probe.expectMsgClass(duration("1 second"), JoinSuccess.class); probe.reply(new Leave(team)); probe.expectMsgClass(duration("1 second"), LeaveSuccess.class); probe.expectNoMsg(duration("1 second")); LobbyBalancer info = (LobbyBalancer) Await.result(Patterns.ask(subject, RequestInformation.INSTANCE, 1000), duration("1 second")); assertEquals(0, info.getLobbies().size()); } }; }
public static Props props(LobbyConfiguration configuration, int min, int max) { return Props.create(LobbyBalancerActor.class, () -> new LobbyBalancerActor(configuration, min, max)); }
LobbyBalancerActor extends AbstractActor { public static Props props(LobbyConfiguration configuration, int min, int max) { return Props.create(LobbyBalancerActor.class, () -> new LobbyBalancerActor(configuration, min, max)); } }
LobbyBalancerActor extends AbstractActor { public static Props props(LobbyConfiguration configuration, int min, int max) { return Props.create(LobbyBalancerActor.class, () -> new LobbyBalancerActor(configuration, min, max)); } private  LobbyBalancerActor(LobbyConfiguration configuration, int min, int max); }
LobbyBalancerActor extends AbstractActor { public static Props props(LobbyConfiguration configuration, int min, int max) { return Props.create(LobbyBalancerActor.class, () -> new LobbyBalancerActor(configuration, min, max)); } private  LobbyBalancerActor(LobbyConfiguration configuration, int min, int max); @Override void preStart(); @Override PartialFunction<Object, BoxedUnit> receive(); static Props props(LobbyConfiguration configuration, int min, int max); static Props props(LobbyConfiguration configuration); }
LobbyBalancerActor extends AbstractActor { public static Props props(LobbyConfiguration configuration, int min, int max) { return Props.create(LobbyBalancerActor.class, () -> new LobbyBalancerActor(configuration, min, max)); } private  LobbyBalancerActor(LobbyConfiguration configuration, int min, int max); @Override void preStart(); @Override PartialFunction<Object, BoxedUnit> receive(); static Props props(LobbyConfiguration configuration, int min, int max); static Props props(LobbyConfiguration configuration);  }