@Test public void getPublicMatchingEventRooms() { when(mockGameFactory.create(1, 0, true, false, null, true, GameMode.EVENT)) .thenReturn(mockGame1); when(mockGame1.isEvent()).thenReturn(true); when(mockGame1.isPublicEvent()).thenReturn(true); when(mockGame1.getTransition()).thenReturn(Transition.Matching); when(mockGameFactory.create(2, 0, true, false, null, false, GameMode.EVENT)) .thenReturn(mockGame2); when(mockGame2.isEvent()).thenReturn(true); when(mockGame2.isPublicEvent()).thenReturn(false); when(mockGame2.getTransition()).thenReturn(Transition.Matching); when(mockGameFactory.create(3, 0, false, false, null, false, GameMode.WHOLE)) .thenReturn(mockGame3); when(mockGame3.isEvent()).thenReturn(false); when(mockGame3.isPublicEvent()).thenReturn(false); when(mockGame3.getTransition()).thenReturn(Transition.Matching); when(mockGameFactory.create(4, 0, true, false, null, true, GameMode.EVENT)) .thenReturn(mockGame3); when(mockGame4.isEvent()).thenReturn(false); when(mockGame4.isPublicEvent()).thenReturn(false); when(mockGame4.getTransition()).thenReturn(Transition.Problem); gameManager.getOrCreateMatchingSession( GameMode.EVENT, "public EVENT name", 0, null, EnumSet.of(ProblemGenre.Anige), EnumSet.of(ProblemType.Marubatsu), true, mockServerStatusManager, 12345678, "192.168.0.1"); gameManager.getOrCreateMatchingSession( GameMode.EVENT, "closed EVENT name", 0, null, EnumSet.of(ProblemGenre.Anige), EnumSet.of(ProblemType.Marubatsu), false, mockServerStatusManager, 12345678, "192.168.0.1"); gameManager.getOrCreateMatchingSession( GameMode.WHOLE, null, 0, null, EnumSet.of(ProblemGenre.Anige), EnumSet.of(ProblemType.Marubatsu), false, mockServerStatusManager, 12345678, "192.168.0.1"); gameManager.getOrCreateMatchingSession( GameMode.EVENT, "playing EVENT name", 0, null, EnumSet.of(ProblemGenre.Anige), EnumSet.of(ProblemType.Marubatsu), true, mockServerStatusManager, 12345678, "192.168.0.1"); List<PacketRoomKey> rooms = gameManager.getPublicMatchingEventRooms(); assertEquals( ImmutableList.of( new PacketRoomKey( GameMode.EVENT, "public EVENT name", EnumSet.of(ProblemGenre.Anige), EnumSet.of(ProblemType.Marubatsu))), rooms); }