diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 1575e64..a6ea9fa 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -183,11 +183,13 @@ public class UsbPlayer implements Device { @Override public String chooseItem(int itemNr) { - String songName=""; + String Message=""; if (itemNr < this.getPlaylist().size() && itemNr >= 0) { - songName= this.getPlaylist().get(itemNr ).toString(); + Message= this.getPlaylist().get(itemNr ).toString(); + }else if(itemNr < 0){ + Message="The Nr is smaller than 0"; } - return songName; + return Message; } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index 93ac0c8..7be24cf 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -558,7 +558,7 @@ class UsbPlayerTest { return Stream.of( Arguments.of("An Item from the Album was chosen ", up1.chooseItem(0), "Musik 01.mp3"), - Arguments.of("Incorrect Nr of Item was given ", up1.chooseItem(-1), "") + Arguments.of("Incorrect Nr of Item was given ", up1.chooseItem(-1), "The Nr is smaller than 0") ); }