Browse Source

UsbPlayerTest.chooseItemTest second Case

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

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

@ -184,7 +184,7 @@ public class UsbPlayer implements Device {
@Override
public String chooseItem(int itemNr) {
String songName="";
if (itemNr < this.getPlaylist().size()) {
if (itemNr < this.getPlaylist().size() && itemNr >= 0) {
songName= this.getPlaylist().get(itemNr ).toString();
}
return songName;

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

@ -557,7 +557,8 @@ class UsbPlayerTest {
UsbPlayer up1 = new UsbPlayer(USBDrive);
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), "")
);
}
Loading…
Cancel
Save