Browse Source

added getYouFMInfoByTime() & added first Test

feature-pr-getVolume
Jan Ortner 3 years ago
parent
commit
63ab603717
  1. 8
      src/main/java/device/radioPlayer/RadioPlayer.java
  2. 7
      src/test/java/device/radioPlayer/RadioPlayerTest.java

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

@ -16,6 +16,14 @@ public class RadioPlayer implements Device {
ArrayList<String> Playlist=new ArrayList<String>(); ArrayList<String> Playlist=new ArrayList<String>();
public String getYouFMInfoByTime(int x) {
if(x >= 5 && x <10 ) return YouFMInfo[0];
else return YouFMInfo[6];
}
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"};
int Lautstaerke = 0; int Lautstaerke = 0;
String playTrack=""; String playTrack="";

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

@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class RadioPlayerTest { class RadioPlayerTest {
RadioPlayer rp = new RadioPlayer();
@ParameterizedTest @ParameterizedTest
@MethodSource("quieterLouderOptions") @MethodSource("quieterLouderOptions")
@ -95,6 +95,11 @@ class RadioPlayerTest {
); );
} }
@Test
void YouFMInfoByTimeTest() {
RadioPlayer rp = new RadioPlayer();
assertThat(rp.getYouFMInfoByTime(8)).describedAs("YouFM info by Time at 8.00").isEqualTo("YOUFM Good Morning Show");
}
/* /*
@Test @Test

Loading…
Cancel
Save