### Question:
PlayerServiceImpl implements PlayerService { @Override public void removeAll() { lock.writeLock().lock(); try { playerGames.clear(); } finally { lock.writeLock().unlock(); } }  @PostConstruct void init(); @Override Player register(String id, String ip, String roomName, String gameName); @Override void reloadAI(String id); @Override Player register(PlayerSave save); @Override void tick(); @Override List<Player> getAll(); @Override List<Player> getAll(String gameName); @Override void remove(String id); @Override void updateAll(List<PlayerInfo> players); @Override void update(Player player); @Override // TODO test me void loadSaveForAll(String gameName, String newSave); @Override boolean contains(String id); @Override Player get(String id); @Override void removeAll(); @Override void removeAll(String roomName); @Override Joystick getJoystick(String id); @Override void closeRegistration(); @Override boolean isRegistrationOpened(); @Override void openRegistration(); @Override void cleanAllScores(); @Override void cleanAllScores(String roomName); @Override void reloadAllRooms(); @Override void reloadAllRooms(String roomName); @Override Player getRandom(String gameType); @Override GameType getAnyGameWithPlayers();  }### Answer:
@Test public void shouldInformGame_whenUnregisterPlayer() { createPlayer(VASYA); createPlayer(PETYA); Game game1 = createGame(gameField(VASYA)); Game game2 = createGame(gameField(PETYA)); setNewGames(game1, game2); playerService.removeAll(); verify(game1).close(); verify(game2).close(); }
@Test public void shouldRemoveAll() { createPlayer(VASYA); createPlayer(PETYA); playerService.removeAll(); assertPlayers("[]"); }
@Test public void shouldRemoveAll_forRoom() { createPlayer(VASYA, "room1", "game1"); createPlayer(PETYA, "room1", "game1"); createPlayer(KATYA, "room2", "game1"); createPlayer(OLIA, "room3", "game3"); playerService.removeAll("room1"); assertPlayers("[katya, olia]"); }