Browse Source

UsbPlayerTest.getInfoTextTest Second Case

feature-pr-USB-otherTests
sahar 3 years ago
parent
commit
717120b972
  1. 7
      src/main/java/device/usbPlayer/USB_Stick.java
  2. 9
      src/main/java/device/usbPlayer/UsbPlayer.java
  3. 11
      src/test/java/device/usbPlayer/UsbPlayerTest.java

7
src/main/java/device/usbPlayer/USB_Stick.java

@ -45,13 +45,6 @@ public class USB_Stick {
Folders.add(a1);
currentAlbum = 0;
for (int i = 0; i < Folders.size(); i++) {
for (int j = 0; j < Folders.get(0).size(); j++) {
System.out.println("the song is "+Folders.get(0).get(j)+"\n");
}
}
}
public ArrayList<String> getAlbum() throws NoFolderFound{

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

@ -156,8 +156,13 @@ public class UsbPlayer implements Device {
@Override
public String getInfoText() {
return "USB Player is on : "+this.getPlayTrack();
String InfoText="";
if (isAllAudio()) {
InfoText="USB Player is on : "+this.getPlayTrack();
}
else
InfoText="USB Player with no Albums";
return InfoText;
}
@Override

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

@ -413,14 +413,21 @@ class UsbPlayerTest {
static Stream<Arguments> getInfoTextOptions() {
USB_Stick USBDrive = new USB_Stick();
ArrayList<String> Fileslist = new ArrayList<String>();
Fileslist.add("file 01.txt");
Fileslist.add("file 02.txt");
Fileslist.add("file 03.txt");
USB_Stick USBwithTXT = new USB_Stick(Fileslist);
//USB_Stick emptyUSB = new USB_Stick("");
//first case
UsbPlayer up1 = new UsbPlayer(USBDrive);
//Second case
UsbPlayer up2 = new UsbPlayer(USBwithTXT);
return Stream.of(
Arguments.of("USB Player with Albums ", up1,"USB Player is on : "+up1.getPlayTrack())
Arguments.of("USB Player with Albums ", up1,"USB Player is on : "+up1.getPlayTrack()),
Arguments.of("USB Player with no Albums ", up2,"USB Player with no Albums")
);
}
Loading…
Cancel
Save