Browse Source

added dynamic station search & time to showStationInfo() & second test case

feature-pr-getVolume
Jan Ortner 3 years ago
parent
commit
4e1a9bdfc3
  1. 12
      src/main/java/device/radioPlayer/RadioPlayer.java
  2. 5
      src/test/java/device/radioPlayer/RadioPlayerTest.java

12
src/main/java/device/radioPlayer/RadioPlayer.java

@ -83,7 +83,7 @@ public class RadioPlayer implements Device {
Playlist.add("Hit Radio FFH"); Playlist.add("Hit Radio FFH");
Playlist.add("HR 1"); Playlist.add("HR 1");
Playlist.add("HR 3"); Playlist.add("HR 3");
Playlist.add("You FM");
Playlist.add("YouFM");
playTrack=Playlist.get(0); playTrack=Playlist.get(0);
break; break;
case "BW": case "BW":
@ -157,6 +157,14 @@ public class RadioPlayer implements Device {
} }
public String showStationInfo() { public String showStationInfo() {
return getYouFMInfoByTime(hour);
switch (playTrack) {
case "Antenne Bayern":
return getAntenneBYInfoByTime(hour);
case "YouFM":
return getYouFMInfoByTime(hour);
default: return "";
}
} }
} }

5
src/test/java/device/radioPlayer/RadioPlayerTest.java

@ -140,9 +140,12 @@ class RadioPlayerTest {
static Stream<Arguments> showStationInfoOptions() { static Stream<Arguments> showStationInfoOptions() {
RadioPlayer rp1 = new RadioPlayer(); RadioPlayer rp1 = new RadioPlayer();
RadioPlayer rp2 = new RadioPlayer();
rp2.changeRegion("BY");
return Stream.of( 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))
); );
} }

Loading…
Cancel
Save