Browse Source

added getBR3InfoByTime() & added Tests

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

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

@ -7,6 +7,8 @@ import java.util.ArrayList;
public class RadioPlayer implements Device {
private int x;
public RadioPlayer() {
super();
Playlist.add("YouFM");
@ -31,6 +33,19 @@ public class RadioPlayer implements Device {
String[] YouFMInfo = {"YOUFM Good Morning Show", "YOUFM Worktime", "YOUFM am Nachmittag", "YOUFM am Abend", "YOUFM Wir feiern euch", "YOUFM Deutschrap ideal", "YOUFM Junge Nacht der ARD"};
public String getBR3InfoByTime(int x) {
if(x >= 5 && x <9) return BR3Info[0];
else if (x >= 9 && x < 12) return BR3Info[1];
else if (x == 12) return BR3Info[2];
else if (x >= 13 && x < 16) return BR3Info[3];
else if (x >= 16 && x < 19) return BR3Info[4];
else if (x >= 19 && x < 21) return BR3Info[5];
else if (x >= 22 && x <= 23) return BR3Info[5];
else return BR3Info[6];
}
String[] BR3Info = {"Sebastian Winkler und die Frühaufdreher", "BAYERN 3 - und DU mittendrin!", "Update", "Hits, Hits, Hits für euren Nachmittag", "Die Zwei für euren Feierabend", "Was geht?!", "Matuschke - der etwas andere Abend","Die Nacht"};
public String getAntenneBYInfoByTime(int x) {
if(x >= 5 && x <9) return AntenneBYInfo[0];
else if (x >= 9 && x < 12) return AntenneBYInfo[1];

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

@ -119,6 +119,18 @@ class RadioPlayerTest {
assertThat(rp.getAntenneBYInfoByTime(3)).describedAs("AntenneBY info by Time at 3.00").isEqualTo("ANTENNE BAYERN Hit-Nacht");
}
@Test
void BR3InfoByTimeTest() {
RadioPlayer rp = new RadioPlayer();
assertThat(rp.getBR3InfoByTime(5)).describedAs("BR3 info by Time at 5.00").isEqualTo("Sebastian Winkler und die Frühaufdreher");
}
@Test
void BR3InfoByTime2Test() {
RadioPlayer rp = new RadioPlayer();
assertThat(rp.getBR3InfoByTime(21)).describedAs("BR3 info by Time at 21.00").isEqualTo("Matuschke - der etwas andere Abend");
}
/*

Loading…
Cancel
Save