From 88078ff752fe2267306b4bfe5994e742dc4adadc Mon Sep 17 00:00:00 2001 From: sahar Date: Wed, 16 Feb 2022 20:52:14 +0100 Subject: [PATCH] USB_StickTest.ChangeAlbumTest First Case --- src/main/java/device/usbPlayer/USB_Stick.java | 25 +++++++++++++------ .../java/device/usbPlayer/USB_StickTest.java | 21 ++++++++++++++++ 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/main/java/device/usbPlayer/USB_Stick.java b/src/main/java/device/usbPlayer/USB_Stick.java index 4b0d4fa..c3d3557 100644 --- a/src/main/java/device/usbPlayer/USB_Stick.java +++ b/src/main/java/device/usbPlayer/USB_Stick.java @@ -4,36 +4,45 @@ import java.util.ArrayList; public class USB_Stick { - public ArrayList> albums = new ArrayList<>(); + public ArrayList> Folders = new ArrayList<>(); + int currentAlbum ; USB_Stick() { ArrayList a1 = new ArrayList(); a1.add("Musik 01.mp3"); a1.add("Musik 02.mp3"); a1.add("Musik 03.mp3"); - albums.add(0,a1); + Folders.add(0,a1); ArrayList a2 = new ArrayList(); 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 a3 = new ArrayList(); a3.add("Photo 01.gif"); a3.add("Photo 02.gif"); a3.add("Photo 03.gif"); - albums.add(2,a3); + Folders.add(2,a3); ArrayList a4 = new ArrayList(); a4.add("Music 01.mp3"); a4.add("Music 02.mp3"); a4.add("Music 03.mp3"); - albums.add(3,a4); + Folders.add(3,a4); + + currentAlbum = 0; + + } public ArrayList getAlbum(){ - return albums.get(0); + return Folders.get(currentAlbum); + } + + public void ChangeAlbum(){ + ++currentAlbum; } } diff --git a/src/test/java/device/usbPlayer/USB_StickTest.java b/src/test/java/device/usbPlayer/USB_StickTest.java index a713b10..4c6f671 100644 --- a/src/test/java/device/usbPlayer/USB_StickTest.java +++ b/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 a = new ArrayList(); + a = s.getAlbum(); + + assertThat(a).describedAs(testName).contains("File 01.txt","File 02.txt","File 03.txt"); + } + + static Stream ChangeAlbumOptions() { + USB_Stick stick = new USB_Stick(); + ArrayList AlbumsItems = new ArrayList<>(); + stick.ChangeAlbum(); + + + return Stream.of( + Arguments.of("First Album is loaded", stick)//,something + ); + } + } \ No newline at end of file