diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index b0dae7a..680109c 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -101,40 +101,38 @@ 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 - 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 - void AntenneBYInfoByTimeTest() { - RadioPlayer rp = new RadioPlayer(); - assertThat(rp.getAntenneBYInfoByTime(8)).describedAs("AntenneBY info by Time at 8.00").isEqualTo("ANTENNE BAYERN Guten Morgen Bayern"); - } - - @Test - void AntenneBYInfoByTime2Test() { - RadioPlayer rp = new RadioPlayer(); - 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"); + @ParameterizedTest + @MethodSource("infoByTimeOptions") + void infoByTimeInfo(String testName, RadioPlayer testRp, String testTyp, int hour, String expectedResult) { + if(testTyp.equals("YouFM")) assertThat(testRp.getYouFMInfoByTime(hour)).describedAs(testName).isEqualTo(expectedResult); + if(testTyp.equals("BR3")) assertThat(testRp.getBR3InfoByTime(hour)).describedAs(testName).isEqualTo(expectedResult); + if(testTyp.equals("AntenneBY")) assertThat(testRp.getAntenneBYInfoByTime(hour)).describedAs(testName).isEqualTo(expectedResult); } - @Test - void BR3InfoByTime2Test() { + static Stream infoByTimeOptions() { RadioPlayer rp = new RadioPlayer(); - assertThat(rp.getBR3InfoByTime(21)).describedAs("BR3 info by Time at 21.00").isEqualTo("Matuschke - der etwas andere Abend"); + return Stream.of( + Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 5, rp.YouFMInfo[0]), + Arguments.of("Station info YouFm at 10:00 am", rp, "YouFM", 10, rp.YouFMInfo[1]), + Arguments.of("Station info YouFm at 2:00 pm", rp, "YouFM", 14, rp.YouFMInfo[2]), + Arguments.of("Station info YouFm at 6:00 pm", rp, "YouFM", 18, rp.YouFMInfo[3]), + Arguments.of("Station info YouFm at 8:00 pm", rp, "YouFM", 20, rp.YouFMInfo[4]), + Arguments.of("Station info YouFm at 10:00 pm", rp, "YouFM", 22, rp.YouFMInfo[5]), + Arguments.of("Station info YouFm at 3:00 am", rp, "YouFM", 3, rp.YouFMInfo[6]), + Arguments.of("Station info BR3 at 5:00 am", rp, "BR3", 5, rp.BR3Info[0]), + Arguments.of("Station info BR3 at 9:00 am", rp, "BR3", 9, rp.BR3Info[1]), + Arguments.of("Station info BR3 at 12:00 am", rp, "BR3", 12, rp.BR3Info[2]), + Arguments.of("Station info BR3 at 1:00 pm", rp, "BR3", 13, rp.BR3Info[3]), + Arguments.of("Station info BR3 at 4:00 pm", rp, "BR3", 16, rp.BR3Info[4]), + Arguments.of("Station info BR3 at 7:00 pm", rp, "BR3", 19, rp.BR3Info[5]), + Arguments.of("Station info BR3 at 9:00 pm", rp, "BR3", 21, rp.BR3Info[6]), + Arguments.of("Station info BR3 at 3:00 am", rp, "BR3", 3, rp.BR3Info[7]), + Arguments.of("Station info AntenneBY at 5:00 am", rp, "AntenneBY", 5, rp.AntenneBYInfo[0]), + Arguments.of("Station info AntenneBY at 9:00 am", rp, "AntenneBY", 9, rp.AntenneBYInfo[1]), + Arguments.of("Station info AntenneBY at 12:00 am", rp, "AntenneBY", 12, rp.AntenneBYInfo[2]), + Arguments.of("Station info AntenneBY at 3:00 pm", rp, "AntenneBY", 15, rp.AntenneBYInfo[3]), + Arguments.of("Station info AntenneBY at 3:00 am", rp, "AntenneBY", 3, rp.AntenneBYInfo[4]) + ); } @ParameterizedTest