@Test public void testJoinSame() throws Exception { new JavaTestKit(system) { { final Props props = LobbyBalancerActor.props(new LobbyConfiguration(2, Duration.ofMinutes(5), Duration.ofMinutes(5), factory), 0, 1); final ActorRef subject = system.actorOf(props); final Join req = new Join(team, getRef()); final JavaTestKit probe = new JavaTestKit(system); final Team snd = new Team(UUID.randomUUID(), "test", 100, new User(UUID.randomUUID(), null)); subject.tell(new Join(snd, probe.getRef()), probe.getRef()); probe.expectMsgClass(duration("1 second"), JoinSuccess.class); probe.reply(new Subscribe(probe.getRef())); subject.tell(req, getRef()); probe.expectMsgClass(duration("1 second"), TeamJoined.class); expectMsgClass(duration("1 second"), JoinSuccess.class); } }; }
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);  }