### Question:
ServerLobby { public synchronized void broadcastUserStateUpdate(UserProxy userProxy) { if(users.contains(userProxy)) { log.debug(userProxy.getUser().getUsername() + " state: < Ready = " + userProxy.getUser().isReady() + ", Spectator = " + userProxy.getUser().isPureSpectator() + ">"); for(ServerLobbyListener listener : listeners) { listener.userStateChanged(new LobbyUserEvent(this, ServerLobbyEvent.EVENT_PLAYER_STATE_CHANGE, userProxy.getUser())); } } } 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 testBroadcastUserStateUpdate() { TestUserProxy testUser = new TestUserProxy(testLobby, "Test User"); testLobby.broadcastUserStateUpdate(testUser); assertEquals(0, testListener.getNumEvents()); testLobby.broadcastUserStateUpdate(null); assertEquals(0, testListener.getNumEvents()); testLobby.addUserProxy(testUser); testLobby.broadcastUserStateUpdate(testUser); assertEquals(testUser.getUser(), testListener.getLastUserEvent().getUser()); }