From 2b45d7bea0d7cb1031b3cdac54e676c183b8074e Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sun, 27 Jun 2021 22:23:57 +0200 Subject: mvn package --- .../jacoco/musichub.business/MusicHub.java.html | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'target/site/jacoco/musichub.business/MusicHub.java.html') diff --git a/target/site/jacoco/musichub.business/MusicHub.java.html b/target/site/jacoco/musichub.business/MusicHub.java.html index d150675..ec5e661 100644 --- a/target/site/jacoco/musichub.business/MusicHub.java.html +++ b/target/site/jacoco/musichub.business/MusicHub.java.html @@ -340,25 +340,25 @@ public class MusicHub { } - public void searchAudioElement() throws UnsupportedAudioFileException, NoAlbumFoundException, LineUnavailableException, IOException { - Scanner scanner = new Scanner(System.in); - System.out.println("Entrez le titre ou l'artiste de la musique que vous souhaitez chercher dans la base de données"); - String word = scanner.next().toLowerCase(Locale.ROOT); - List<AudioElement> searchResult = new ArrayList<>(); - for(AudioElement el : elements){ - if(el.getTitle().toLowerCase(Locale.ROOT).contains(word) || el.getArtist().toLowerCase(Locale.ROOT).contains(word)){ - searchResult.add(el); - System.out.println(el); + public void searchAudioElement() throws UnsupportedAudioFileException, NoAlbumFoundException, LineUnavailableException, IOException, NoElementFoundException { + Scanner scanner = new Scanner(System.in); + System.out.println("Entrez le titre ou l'artiste de la musique que vous souhaitez chercher dans la base de données"); + String word = scanner.next().toLowerCase(Locale.ROOT); + List<AudioElement> searchResult = new ArrayList<>(); + for(AudioElement el : elements){ + if(el.getTitle().toLowerCase(Locale.ROOT).contains(word) || el.getArtist().toLowerCase(Locale.ROOT).contains(word)){ + searchResult.add(el); + System.out.println(el); } - } + } - if(searchResult.isEmpty()){ - System.err.println("Aucun résultat pour votre recherche"); + if(searchResult.isEmpty()){ + throw new NoElementFoundException("Any result for your search"); } - if (searchResult.size()==1){ - this.getAudioElement(searchResult, searchResult.get(0).getTitle()); + if (searchResult.size()==1){ + this.getAudioElement(searchResult, searchResult.get(0).getTitle()); } - } + } } \ No newline at end of file -- cgit v1.2.3