Browse Source

UsbPlayerTest.chooseItemTest second Case with changes

feature-pr-USB-otherTests
sahar 3 years ago
parent
commit
83f5e50640
  1. 8
      src/main/java/device/usbPlayer/UsbPlayer.java
  2. 2
      src/test/java/device/usbPlayer/UsbPlayerTest.java

8
src/main/java/device/usbPlayer/UsbPlayer.java

@ -183,11 +183,13 @@ public class UsbPlayer implements Device {
@Override @Override
public String chooseItem(int itemNr) { public String chooseItem(int itemNr) {
String songName="";
String Message="";
if (itemNr < this.getPlaylist().size() && itemNr >= 0) { 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;
} }

2
src/test/java/device/usbPlayer/UsbPlayerTest.java

@ -558,7 +558,7 @@ class UsbPlayerTest {
return Stream.of( return Stream.of(
Arguments.of("An Item from the Album was chosen ", up1.chooseItem(0), "Musik 01.mp3"), 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")
); );
} }
Loading…
Cancel
Save