From 27f942760b3a051186eb794ad4a2f86c5f0638c5 Mon Sep 17 00:00:00 2001 From: sahar Date: Tue, 15 Feb 2022 18:35:16 +0100 Subject: [PATCH] UsbPlayerTest.GoToLastTest first Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 4 ++++ .../java/device/usbPlayer/UsbPlayerTest.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index c1233c6..1f395c8 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -215,4 +215,8 @@ public class UsbPlayer implements Device { //go to the first song in the list setPlayTrack(getPlaylist().get(0)); } + + public void GoToLast() { + setPlayTrack("Musik 03.mp3"); + } } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index 25359e6..8822fde 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -336,5 +336,21 @@ class UsbPlayerTest { ); } + @ParameterizedTest + @MethodSource("GoToLastOptions") + void GoToLastTest(String testName, UsbPlayer inputUSB, String expectedResult) { + String firstSong = inputUSB.getPlayTrack(); + assertThat(firstSong ).describedAs(testName).isEqualTo(expectedResult); + } + + static Stream GoToLastOptions() { + UsbPlayer up1 = new UsbPlayer(); + up1.GoToLast(); + + + return Stream.of( + Arguments.of("It should go to the first Song ", up1,"Musik 03.mp3") + ); + } } \ No newline at end of file