From 280b8843f2544821bbeab4f657a0d23be011f788 Mon Sep 17 00:00:00 2001 From: sahar Date: Tue, 15 Feb 2022 18:16:05 +0100 Subject: [PATCH] UsbPlayerTest.GoToFirstTest first Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 3 +++ .../java/device/usbPlayer/UsbPlayerTest.java | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 992ba76..194128e 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -211,4 +211,7 @@ public class UsbPlayer implements Device { return false; } + public void GoToFirst() { + setPlayTrack("Musik 01.mp3"); + } } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index 9c553f8..5b12b03 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -309,5 +309,22 @@ class UsbPlayerTest { ); } + //GoToFirst() + @ParameterizedTest + @MethodSource("GoToFirstOptions") + void GoToFirstTest(String testName, UsbPlayer inputUSB, String expectedResult) { + String firstSong = inputUSB.getPlayTrack(); + assertThat(firstSong ).describedAs(testName).isEqualTo(expectedResult); + } + + static Stream GoToFirstOptions() { + UsbPlayer up1 = new UsbPlayer(); + up1.GoToFirst(); + + return Stream.of( + Arguments.of("It should go to the first Song ", up1,up1.getPlaylist().get(0)) + ); + } + } \ No newline at end of file