### Question:
ServerLobby { public synchronized boolean addUserProxy(UserProxy userProxy) { if(userProxy == null || !userProxy.isConnected()) { log.error("Attempt to add null or unconnected user proxy."); return false; } boolean addSuccess = false; if(users.size() < maxUsers) { users.add(userProxy); addSuccess = true; log.debug(userProxy.getUser().getUsername() + " added to lobby."); addLobbyStateListener(userProxy); for(ServerLobbyListener listener : listeners) { listener.userStateChanged(new LobbyUserEvent(this, ServerLobbyEvent.EVENT_PLAYER_JOINED, userProxy.getUser())); } } else { if(userProxy != null) { log.debug(userProxy.getUser().getUsername() + " attempted to join full server."); } } return addSuccess; } ServerLobby(String serverName, int maxRobots, int maxUsers); synchronized void addLobbyStateListener(ServerLobbyListener listener); synchronized void removeLobbyStateListener(ServerLobbyListener listener); synchronized boolean addUserProxy(UserProxy userProxy); synchronized void removeUserProxy(UserProxy userProxy); synchronized boolean registerRobot(RobotProxy robot); synchronized void unregisterRobot(RobotProxy robot); synchronized void broadcastMessage(String message); synchronized void broadcastUserStateUpdate(UserProxy userProxy); synchronized void setGameType(GameType newType); boolean gameInProgress(); GameController getCurrentGame(); GameType getCurrentGameType(); synchronized RobotProxy getRobotProxy(String identifier); synchronized boolean isUsernameRegistered(String username); String getServerName(); synchronized void launchGame(); synchronized void endCurrentGame();  }### Answer:
@Test public void testAddUserProxy() { ArrayList<TestUserProxy> testUsers = new ArrayList<TestUserProxy>(); for(int i = 0; i < TEST_MAX_PLAYERS + 1; i++) { TestUserProxy testUser = new TestUserProxy(testLobby, "TestUser" + Integer.toString(i)); testUsers.add(testUser); } for(int i = 0; i < TEST_MAX_PLAYERS; i++) { testLobby.addUserProxy(testUsers.get(i)); assertEquals(testUsers.get(i).getUser(), testListener.getLastUserEvent().getUser()); assertEquals(ServerLobbyEvent.EVENT_PLAYER_JOINED, testListener.getLastUserEvent().getEventType()); } testListener.clearNumEvents(); assertEquals(false, testLobby.addUserProxy(testUsers.get(TEST_MAX_PLAYERS))); assertEquals(false, testLobby.addUserProxy(null)); assertEquals(0, testListener.getNumEvents()); while(!testUsers.isEmpty()) { TestUserProxy testUser = testUsers.remove(0); testLobby.removeUserProxy(testUser); testUser = null; } }