From 64d70c3921102b3e764079375b7c0d72e5cc3789 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 10 Feb 2022 21:42:50 +0100 Subject: [PATCH] added showStationInfo() & first test case --- src/main/java/device/radioPlayer/RadioPlayer.java | 4 ++++ .../java/device/radioPlayer/RadioPlayerTest.java | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index ce419ce..b199256 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -155,4 +155,8 @@ public class RadioPlayer implements Device { public String play() { return null; } + + public String showStationInfo() { + return getYouFMInfoByTime(hour); + } } diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index 124e318..5b948f3 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -131,6 +131,20 @@ class RadioPlayerTest { assertThat(rp.getBR3InfoByTime(21)).describedAs("BR3 info by Time at 21.00").isEqualTo("Matuschke - der etwas andere Abend"); } + @ParameterizedTest + @MethodSource("showStationInfoOptions") + void showStationInfo(String testName, RadioPlayer testRp, String expectedResult) { + String info = testRp.showStationInfo(); + assertThat(info).describedAs(testName).isEqualTo(expectedResult); + } + + static Stream showStationInfoOptions() { + RadioPlayer rp1 = new RadioPlayer(); + + return Stream.of( + Arguments.of("Show Station Info for first saved Radio", rp1, rp1.getYouFMInfoByTime(rp1.hour)) + ); + } /*