From dfeb952e3670acca4d28fc90f63e84e05869f53e Mon Sep 17 00:00:00 2001 From: sahar Date: Sun, 13 Feb 2022 14:04:11 +0100 Subject: [PATCH] UsbPlayerTest.GoToTest First Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 5 +++++ .../java/device/usbPlayer/UsbPlayerTest.java | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 0f824c7..a0956ca 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -201,4 +201,9 @@ public class UsbPlayer implements Device { return index; } + public boolean GoTo(String songName){ + playTrack = songName; + return true; + } + } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index bea06ae..9e1f4b1 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -212,4 +212,22 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { ); } + @ParameterizedTest + @MethodSource("GoToOptions") + void GoToTest(String testName, UsbPlayer inputPlay, String expectedResult) { + String current_Track = inputPlay.getPlayTrack(); + assertThat(current_Track).describedAs(testName).isEqualTo(expectedResult); + } + + static Stream GoToOptions() { + UsbPlayer up1 = new UsbPlayer(); + up1.GoTo("Musik 03.mp3"); + + return Stream.of( + Arguments.of("Go to Song : Musik 03.mp3 ", up1, "Musik 03.mp3") + + ); + } + + } \ No newline at end of file