### Question:
ServerLobby { public synchronized boolean registerRobot(RobotProxy robot) { boolean addSuccess = false; if(robots.size() < maxRobots && !robots.contains(robot)) { robots.add(robot); addSuccess = true; log.debug("Robot: " + robot.getIdentifier() + " added to lobby."); for(ServerLobbyListener listener : listeners) { listener.robotStateChanged(new LobbyRobotEvent(this, ServerLobbyEvent.EVENT_ROBOT_REGISTERED, robot)); } } 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 testRegisterRobot() { ArrayList<RobotProxy> testRobots = new ArrayList<RobotProxy>(); for(int i = 0; i < TEST_MAX_ROBOTS + 1; i++) { RobotProxy testRobot = new TestRobotProxy(testLobby, "RegisterRobot" + Integer.toString(i)); testRobots.add(testRobot); if(i < TEST_MAX_ROBOTS) { assertEquals(testRobots.get(i), testListener.getLastRobotEvent().getRobot()); assertEquals(ServerLobbyEvent.EVENT_ROBOT_REGISTERED, testListener.getLastRobotEvent().getEventType()); } } testListener.clearNumEvents(); assertEquals(false, testLobby.registerRobot(testRobots.get(TEST_MAX_ROBOTS))); assertEquals(false, testLobby.registerRobot(null)); assertEquals(0, testListener.getNumEvents()); while(!testRobots.isEmpty()) { RobotProxy testRobot = testRobots.remove(0); testLobby.unregisterRobot(testRobot); testRobot = null; } }