From 4e1a9bdfc3bb01f5b26235c9201f4fcb8c229605 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 10 Feb 2022 21:49:55 +0100 Subject: [PATCH] added dynamic station search & time to showStationInfo() & second test case --- src/main/java/device/radioPlayer/RadioPlayer.java | 12 ++++++++++-- .../java/device/radioPlayer/RadioPlayerTest.java | 5 ++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index b199256..9f928a1 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -83,7 +83,7 @@ public class RadioPlayer implements Device { Playlist.add("Hit Radio FFH"); Playlist.add("HR 1"); Playlist.add("HR 3"); - Playlist.add("You FM"); + Playlist.add("YouFM"); playTrack=Playlist.get(0); break; case "BW": @@ -157,6 +157,14 @@ public class RadioPlayer implements Device { } public String showStationInfo() { - return getYouFMInfoByTime(hour); + switch (playTrack) { + case "Antenne Bayern": + return getAntenneBYInfoByTime(hour); + case "YouFM": + return getYouFMInfoByTime(hour); + default: return ""; + } + + } } diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index 5b948f3..2861364 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -140,9 +140,12 @@ class RadioPlayerTest { static Stream showStationInfoOptions() { RadioPlayer rp1 = new RadioPlayer(); + RadioPlayer rp2 = new RadioPlayer(); + rp2.changeRegion("BY"); return Stream.of( - Arguments.of("Show Station Info for first saved Radio", rp1, rp1.getYouFMInfoByTime(rp1.hour)) + Arguments.of("Show Station Info for first saved Radio", rp1, rp1.getYouFMInfoByTime(rp1.hour)), + Arguments.of("Show Station Info for regional Station", rp2, rp2.getAntenneBYInfoByTime(rp2.hour)) ); }