From 83f5e5064022d3523f509db9ecf22de21cc68c78 Mon Sep 17 00:00:00 2001 From: sahar Date: Fri, 18 Feb 2022 00:42:29 +0100 Subject: [PATCH] UsbPlayerTest.chooseItemTest second Case with changes --- src/main/java/device/usbPlayer/UsbPlayer.java | 8 +++++--- src/test/java/device/usbPlayer/UsbPlayerTest.java | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) 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") ); }