@Test public void testTransitToIntermission() throws Exception { new JavaTestKit(system) { { final JavaTestKit probe = new JavaTestKit(system); final LobbyScheduleFactory factory = new StaticLobbyScheduleFactory(Collections.singletonList(new GrandPrix(UUID.randomUUID(), new Circuit(UUID.randomUUID(), "Monza", "Italy", 0), Instant.now(), 0, 1))); final Props props = LobbyActor.props(new LobbyConfiguration(2, Duration.ofMillis(250), Duration.ZERO, factory)); final ActorRef subject = system.actorOf(props); final Subscribe req = new Subscribe(probe.getRef()); subject.tell(req, probe.getRef()); subject.tell(new Join(new Team(UUID.randomUUID(), "test", 100, new User(UUID.randomUUID(), null)), getRef()), getRef()); expectMsgClass(duration("1 second"), JoinSuccess.class); probe.expectMsgClass(duration("1 second"), TeamJoined.class); probe.expectMsgEquals(duration("1 second"), new LobbyStatusChanged(LobbyStatus.INTERMISSION, LobbyStatus.PREPARATION)); probe.expectMsgEquals(duration("1 second"), new LobbyStatusChanged(LobbyStatus.PREPARATION, LobbyStatus.PROGRESSION)); probe.expectMsgClass(duration("5 second"), RaceSimulationStarted.class); probe.expectMsgClass(duration("3 second"), RaceSimulationResult.class); probe.expectMsgEquals(duration("2 second"), new LobbyStatusChanged(LobbyStatus.PROGRESSION, LobbyStatus.INTERMISSION)); system.stop(subject); } }; }
private void transitToIntermission(LobbyStatusChanged event) { log.info("Changing lobby status from {} to {}", event.getPrevious(), event.getStatus()); bus.tell(event, self()); schedule.poll(); context().become(intermission()); }
LobbyActor extends AbstractActor { private void transitToIntermission(LobbyStatusChanged event) { log.info("Changing lobby status from {} to {}", event.getPrevious(), event.getStatus()); bus.tell(event, self()); schedule.poll(); context().become(intermission()); } }
LobbyActor extends AbstractActor { private void transitToIntermission(LobbyStatusChanged event) { log.info("Changing lobby status from {} to {}", event.getPrevious(), event.getStatus()); bus.tell(event, self()); schedule.poll(); context().become(intermission()); } private  LobbyActor(LobbyConfiguration configuration); }
LobbyActor extends AbstractActor { private void transitToIntermission(LobbyStatusChanged event) { log.info("Changing lobby status from {} to {}", event.getPrevious(), event.getStatus()); bus.tell(event, self()); schedule.poll(); context().become(intermission()); } private  LobbyActor(LobbyConfiguration configuration); @Override PartialFunction<Object, BoxedUnit> receive(); static Props props(LobbyConfiguration configuration); }
LobbyActor extends AbstractActor { private void transitToIntermission(LobbyStatusChanged event) { log.info("Changing lobby status from {} to {}", event.getPrevious(), event.getStatus()); bus.tell(event, self()); schedule.poll(); context().become(intermission()); } private  LobbyActor(LobbyConfiguration configuration); @Override PartialFunction<Object, BoxedUnit> receive(); static Props props(LobbyConfiguration configuration);  }