Browse Source

bug fix renaming saved stations

feature-pr-changeRegion
Jan Ortner 3 years ago
parent
commit
7b164b510a
  1. 19
      src/main/java/device/radioPlayer/RadioPlayer.java
  2. 9
      src/test/java/device/radioPlayer/RadioPlayerTest.java

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

@ -8,9 +8,9 @@ public class RadioPlayer implements Device {
public RadioPlayer() { public RadioPlayer() {
super(); super();
Playlist.add("Radio YouFM");
Playlist.add("Radio Teddy");
Playlist.add("Radio MegaHits");
Playlist.add("YouFM");
Playlist.add("Teddy");
Playlist.add("MegaHits");
playTrack=Playlist.get(0); playTrack=Playlist.get(0);
} }
@ -29,7 +29,7 @@ public class RadioPlayer implements Device {
public void changeRegion(String region){ public void changeRegion(String region){
switch (region) { switch (region) {
case "Bayern":
case "BY":
Playlist.clear(); Playlist.clear();
Playlist.add("Antenne Bayern"); Playlist.add("Antenne Bayern");
Playlist.add("Bayern 1"); Playlist.add("Bayern 1");
@ -37,7 +37,7 @@ public class RadioPlayer implements Device {
Playlist.add("Hit Radio N1"); Playlist.add("Hit Radio N1");
playTrack=Playlist.get(0); playTrack=Playlist.get(0);
break; break;
case "Hessen":
case "HE":
Playlist.clear(); Playlist.clear();
Playlist.add("Hit Radio FFH"); Playlist.add("Hit Radio FFH");
Playlist.add("HR 1"); Playlist.add("HR 1");
@ -45,12 +45,21 @@ public class RadioPlayer implements Device {
Playlist.add("You FM"); Playlist.add("You FM");
playTrack=Playlist.get(0); playTrack=Playlist.get(0);
break; break;
case "BW":
Playlist.clear();
Playlist.add("DASDING");
Playlist.add("SWR 1");
Playlist.add("SWR 3");
Playlist.add("sunshine live");
playTrack=Playlist.get(0);
break;
default: default:
Playlist.clear(); Playlist.clear();
Playlist.add("YouFM"); Playlist.add("YouFM");
Playlist.add("Teddy"); Playlist.add("Teddy");
Playlist.add("MegaHits"); Playlist.add("MegaHits");
playTrack=Playlist.get(0); playTrack=Playlist.get(0);
break;
} }
} }

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

@ -54,12 +54,15 @@ class RadioPlayerTest {
static Stream<Arguments> changeRegionOptions() { static Stream<Arguments> changeRegionOptions() {
RadioPlayer rp1 = new RadioPlayer(); RadioPlayer rp1 = new RadioPlayer();
RadioPlayer rp2 = new RadioPlayer(); RadioPlayer rp2 = new RadioPlayer();
rp1.changeRegion("Bayern");
rp2.changeRegion("Hessen");
RadioPlayer rp3 = new RadioPlayer();
rp1.changeRegion("BY");
rp2.changeRegion("HE");
rp3.changeRegion("BW");
return Stream.of( return Stream.of(
Arguments.of("Test change Region to Bayern", rp1, "Antenne Bayern"), Arguments.of("Test change Region to Bayern", rp1, "Antenne Bayern"),
Arguments.of("Test change Region to Hessen", rp2, "Hit Radio FFH")
Arguments.of("Test change Region to Hessen", rp2, "Hit Radio FFH"),
Arguments.of("Test change Region to Baden-Wuerttemberg", rp3, "DASDING")
); );
} }

Loading…
Cancel
Save