MediaPlayers extends Helper { public MediaPlayer add() { int id = 0; do { id++; } while (players.get(id) != null); return add(id); } MediaPlayers(Tracker tracker); MediaPlayer add(); MediaPlayer add(int playerId); void remove(int playerId); void removeAll();  }
@Test public void addOneTest() { assertEquals(1, mediaPlayers.add().getPlayerId()); assertEquals(2, mediaPlayers.add().getPlayerId()); assertEquals(3, mediaPlayers.add().getPlayerId()); assertEquals(3, mediaPlayers.players.size()); assertNotNull(mediaPlayers.players.get(1)); assertNotNull(mediaPlayers.players.get(2)); assertNotNull(mediaPlayers.players.get(3)); }
@Test public void addTwoTest() { assertEquals(189, mediaPlayers.add(189).getPlayerId()); assertEquals(189, mediaPlayers.add(189).getPlayerId()); assertEquals(1, mediaPlayers.players.size()); assertNotNull(mediaPlayers.players.get(189)); assertNull(mediaPlayers.players.get(1)); }