@Test public void addFourTest() { audios.add("name", "chapter1", "chapter2", "chapter3", 80); assertEquals(1, audios.list.size()); assertEquals("name", audios.list.get(0).getName()); assertEquals("name", audios.list.get(0).getMediaLabel()); assertEquals("chapter1", audios.list.get(0).getChapter1()); assertEquals("chapter1", audios.list.get(0).getMediaTheme1()); assertEquals("chapter2", audios.list.get(0).getChapter2()); assertEquals("chapter2", audios.list.get(0).getMediaTheme2()); assertEquals("chapter3", audios.list.get(0).getChapter3()); assertEquals("chapter3", audios.list.get(0).getMediaTheme3()); assertEquals(80, audios.list.get(0).getDuration()); }
public Audio add(String mediaLabel, int duration) { Audio audio; int index = searchAudioIndexByMediaLabel(mediaLabel); if (index == -1) { audio = new Audio(player) .setMediaLabel(mediaLabel) .setDuration(duration); list.add(audio); } else { Tool.executeCallback(player.getTracker().getListener(), Tool.CallbackType.WARNING, "This Audio already exists"); audio = list.get(index); } return audio; }
Audios { public Audio add(String mediaLabel, int duration) { Audio audio; int index = searchAudioIndexByMediaLabel(mediaLabel); if (index == -1) { audio = new Audio(player) .setMediaLabel(mediaLabel) .setDuration(duration); list.add(audio); } else { Tool.executeCallback(player.getTracker().getListener(), Tool.CallbackType.WARNING, "This Audio already exists"); audio = list.get(index); } return audio; } }
Audios { public Audio add(String mediaLabel, int duration) { Audio audio; int index = searchAudioIndexByMediaLabel(mediaLabel); if (index == -1) { audio = new Audio(player) .setMediaLabel(mediaLabel) .setDuration(duration); list.add(audio); } else { Tool.executeCallback(player.getTracker().getListener(), Tool.CallbackType.WARNING, "This Audio already exists"); audio = list.get(index); } return audio; } Audios(MediaPlayer player); }
Audios { public Audio add(String mediaLabel, int duration) { Audio audio; int index = searchAudioIndexByMediaLabel(mediaLabel); if (index == -1) { audio = new Audio(player) .setMediaLabel(mediaLabel) .setDuration(duration); list.add(audio); } else { Tool.executeCallback(player.getTracker().getListener(), Tool.CallbackType.WARNING, "This Audio already exists"); audio = list.get(index); } return audio; } Audios(MediaPlayer player); Audio add(String mediaLabel, int duration); Audio add(String mediaLabel, String mediaTheme1, int duration); Audio add(String mediaLabel, String mediaTheme1, String mediaTheme2, int duration); Audio add(String mediaLabel, String mediaTheme1, String mediaTheme2, String mediaTheme3, int duration); void remove(String mediaLabel); void removeAll(); }
Audios { public Audio add(String mediaLabel, int duration) { Audio audio; int index = searchAudioIndexByMediaLabel(mediaLabel); if (index == -1) { audio = new Audio(player) .setMediaLabel(mediaLabel) .setDuration(duration); list.add(audio); } else { Tool.executeCallback(player.getTracker().getListener(), Tool.CallbackType.WARNING, "This Audio already exists"); audio = list.get(index); } return audio; } Audios(MediaPlayer player); Audio add(String mediaLabel, int duration); Audio add(String mediaLabel, String mediaTheme1, int duration); Audio add(String mediaLabel, String mediaTheme1, String mediaTheme2, int duration); Audio add(String mediaLabel, String mediaTheme1, String mediaTheme2, String mediaTheme3, int duration); void remove(String mediaLabel); void removeAll();  }