@Test public void isCorrectPlayerInGameNoPlayer() { when(service.isAuthorized(anyString())).thenReturn(true); when(service.getUserBySession(anyString())).thenReturn(null); assertFalse(gameServer.isCorrectPlayerInGame("aa")); }
@Test public void testIsCorrectPlayerInGameAlready() throws Exception { when(service.isAuthorized(anyString())).thenReturn(true); UserProfile profile = new UserProfile("test", "test"); Room room = new RoomFFA("testRoom"); profile.setCurrentroom(room); when(service.getUserBySession(anyString())).thenReturn(profile); assertTrue(gameServer.isCorrectPlayerInGame("aa")); }
@Test public void testIsCorrectPlayerInGameNoAuth() throws Exception { when(service.isAuthorized(anyString())).thenReturn(false); assertFalse(gameServer.isCorrectPlayerInGame("aa")); }