From 32693bf8fa226e281eb1cf3b49c9d72ecabb78d1 Mon Sep 17 00:00:00 2001 From: sahar Date: Fri, 18 Feb 2022 01:37:50 +0100 Subject: [PATCH] UsbPlayerTest.getItemList First Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 6 ++++- .../java/device/usbPlayer/UsbPlayerTest.java | 23 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index a5ca30e..e3394a7 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -196,7 +196,11 @@ public class UsbPlayer implements Device { @Override public String[] getItemList() { - return null; + String array[] = new String[getPlaylist().size()]; + for(int j =0;j 0", up1.chooseItem(5), "The Nr is bigger than 0") ); + }//getItemList + + @ParameterizedTest + @MethodSource("getItemList") + void getItemListTest(String testName, UsbPlayer inputPlayer, String[] expectedResult) { + String[] Pl = inputPlayer.getItemList(); + + assertThat(Pl).contains("Musik 01.mp3","Musik 02.mp3","Musik 03.mp3").describedAs(testName); + } + + static Stream getItemList() { + USB_Stick USBDrive = new USB_Stick(); + UsbPlayer up1 = new UsbPlayer(USBDrive); + String[] Pl = {"Musik 01.mp3","Musik 02.mp3","Musik 03.mp3"}; + + return Stream.of( + Arguments.of("An Album was returned ", up1, Pl,1) + + ); } } \ No newline at end of file