From 63ab60371700f3b3763dded433c30a82f23980c6 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 10 Feb 2022 21:05:25 +0100 Subject: [PATCH] added getYouFMInfoByTime() & added first Test --- src/main/java/device/radioPlayer/RadioPlayer.java | 8 ++++++++ src/test/java/device/radioPlayer/RadioPlayerTest.java | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index 36d7170..b260bbd 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -16,6 +16,14 @@ public class RadioPlayer implements Device { ArrayList Playlist=new ArrayList(); + 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; String playTrack=""; diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index 89092ba..042ea65 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -14,7 +14,7 @@ import static org.assertj.core.api.Assertions.assertThat; class RadioPlayerTest { - RadioPlayer rp = new RadioPlayer(); + @ParameterizedTest @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