Browse Source

added complete code for getYouFMInfoByTime() & added Test for time 3:00 am

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

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

@ -18,6 +18,11 @@ public class RadioPlayer implements Device {
public String getYouFMInfoByTime(int x) {
if(x >= 5 && x <10 ) return YouFMInfo[0];
else if (x >= 10 && x < 14) return YouFMInfo[1];
else if (x >= 14 && x < 18) return YouFMInfo[2];
else if (x >= 18 && x < 20) return YouFMInfo[3];
else if (x >= 20 && x < 22) return YouFMInfo[4];
else if (x >= 22 && x <= 23) return YouFMInfo[5];
else return YouFMInfo[6];
}

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

@ -100,6 +100,12 @@ class RadioPlayerTest {
RadioPlayer rp = new RadioPlayer();
assertThat(rp.getYouFMInfoByTime(8)).describedAs("YouFM info by Time at 8.00").isEqualTo("YOUFM Good Morning Show");
}
@Test
void YouFMInfoByTime2Test() {
RadioPlayer rp = new RadioPlayer();
assertThat(rp.getYouFMInfoByTime(3)).describedAs("YouFM info by Time at 3.00").isEqualTo("YOUFM Junge Nacht der ARD");
}
/*
@Test

Loading…
Cancel
Save