MediaPlayers extends Helper { public void remove(int playerId) { MediaPlayer player = players.remove(playerId); if (player != null) { player.Videos().removeAll(); player.LiveVideos().removeAll(); player.Audios().removeAll(); player.LiveAudios().removeAll(); player.Media().removeAll(); player.LiveMedia().removeAll(); } } MediaPlayers(Tracker tracker); MediaPlayer add(); MediaPlayer add(int playerId); void remove(int playerId); void removeAll();  }
@Test public void removeTest() { assertEquals(1, mediaPlayers.add().getPlayerId()); assertEquals(2, mediaPlayers.add().getPlayerId()); assertEquals(3, mediaPlayers.add().getPlayerId()); assertEquals(3, mediaPlayers.players.size()); mediaPlayers.remove(3); assertEquals(2, mediaPlayers.players.size()); assertNull(mediaPlayers.players.get(3)); }