Browse Source

USB_StickTest.ChangeAlbumTest First Case

feature-pr-USB-otherTests
sahar 3 years ago
parent
commit
88078ff752
  1. 25
      src/main/java/device/usbPlayer/USB_Stick.java
  2. 21
      src/test/java/device/usbPlayer/USB_StickTest.java

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

@ -4,36 +4,45 @@ import java.util.ArrayList;
public class USB_Stick { public class USB_Stick {
public ArrayList<ArrayList<String>> albums = new ArrayList<>();
public ArrayList<ArrayList<String>> Folders = new ArrayList<>();
int currentAlbum ;
USB_Stick() { USB_Stick() {
ArrayList<String> a1 = new ArrayList<String>(); ArrayList<String> a1 = new ArrayList<String>();
a1.add("Musik 01.mp3"); a1.add("Musik 01.mp3");
a1.add("Musik 02.mp3"); a1.add("Musik 02.mp3");
a1.add("Musik 03.mp3"); a1.add("Musik 03.mp3");
albums.add(0,a1);
Folders.add(0,a1);
ArrayList<String> a2 = new ArrayList<String>(); ArrayList<String> a2 = new ArrayList<String>();
a2.add("File 01.txt"); a2.add("File 01.txt");
a2.add("File 01.txt");
a2.add("File 01.txt");
albums.add(1,a2);
a2.add("File 02.txt");
a2.add("File 03.txt");
Folders.add(1,a2);
ArrayList<String> a3 = new ArrayList<String>(); ArrayList<String> a3 = new ArrayList<String>();
a3.add("Photo 01.gif"); a3.add("Photo 01.gif");
a3.add("Photo 02.gif"); a3.add("Photo 02.gif");
a3.add("Photo 03.gif"); a3.add("Photo 03.gif");
albums.add(2,a3);
Folders.add(2,a3);
ArrayList<String> a4 = new ArrayList<String>(); ArrayList<String> a4 = new ArrayList<String>();
a4.add("Music 01.mp3"); a4.add("Music 01.mp3");
a4.add("Music 02.mp3"); a4.add("Music 02.mp3");
a4.add("Music 03.mp3"); a4.add("Music 03.mp3");
albums.add(3,a4);
Folders.add(3,a4);
currentAlbum = 0;
} }
public ArrayList<String> getAlbum(){ public ArrayList<String> getAlbum(){
return albums.get(0);
return Folders.get(currentAlbum);
}
public void ChangeAlbum(){
++currentAlbum;
} }
} }

21
src/test/java/device/usbPlayer/USB_StickTest.java

@ -30,4 +30,25 @@ class USB_StickTest {
); );
} }
//ChangeAlbum
@ParameterizedTest
@MethodSource("ChangeAlbumOptions")
void ChangeAlbumTest(String testName, USB_Stick s) {//, int expectedResult
ArrayList<String> a = new ArrayList<String>();
a = s.getAlbum();
assertThat(a).describedAs(testName).contains("File 01.txt","File 02.txt","File 03.txt");
}
static Stream<Arguments> ChangeAlbumOptions() {
USB_Stick stick = new USB_Stick();
ArrayList<String> AlbumsItems = new ArrayList<>();
stick.ChangeAlbum();
return Stream.of(
Arguments.of("First Album is loaded", stick)//,something
);
}
} }
Loading…
Cancel
Save