From c350b06358eaccff1c7961614bc165a0b59d3a63 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Mon, 14 Feb 2022 20:47:16 +0100 Subject: [PATCH] added play() and first test for first saved station --- .../java/device/radioPlayer/RadioPlayer.java | 2 +- .../java/device/radioPlayer/RadioPlayerTest.java | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index 1afb257..927fff4 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -149,7 +149,7 @@ public class RadioPlayer implements Device { @Override public String play() { - return null; + return ("Radio is playing station: 0"+(Playlist.indexOf(playTrack)+1)+ " "+this.playTrack); } public String showStationInfo() { diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index e7c0b3a..0d11d3a 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -164,10 +164,20 @@ class RadioPlayerTest { @Test void chooseOption() { } +*/ +@ParameterizedTest +@MethodSource("testPlayOptions") +void testPlay(String testName, RadioPlayer testRp, String expectedResult) { + String playedStation = testRp.play(); + assertThat(playedStation).describedAs(testName).isEqualTo(expectedResult); +} - @Test - void play() { + static Stream testPlayOptions() { + RadioPlayer rp1 = new RadioPlayer(); + + return Stream.of( + Arguments.of("Test for playing first station on saved playlist", rp1, "Radio is playing station: 01 YouFM") + ); } - */ } \ No newline at end of file