From fc98df250dfd70538ee1aa7d86dfe44efeed8d1e Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 17 Feb 2022 02:00:44 +0100 Subject: [PATCH 1/3] revised test for RadioPlayer getYouFMInfoByTime() --- .../device/radioPlayer/RadioPlayerTest.java | 45 ++++++------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index b0dae7a..51a85cf 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -101,40 +101,23 @@ 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); } - @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 5:00 am", rp, "YouFM", 10, rp.YouFMInfo[1]), + Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 14, rp.YouFMInfo[2]), + Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 18, rp.YouFMInfo[3]), + Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 20, rp.YouFMInfo[4]), + Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 22, rp.YouFMInfo[5]), + Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 3, rp.YouFMInfo[6]) + ); } @ParameterizedTest From 089fa0144fc4cee135db2b69a6ec138c1902d440 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 17 Feb 2022 02:07:22 +0100 Subject: [PATCH 2/3] revised test for RadioPlayer getBR3InfoByTime() --- .../device/radioPlayer/RadioPlayerTest.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index 51a85cf..d409765 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -105,18 +105,27 @@ class RadioPlayerTest { @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); } static Stream infoByTimeOptions() { RadioPlayer rp = new RadioPlayer(); return Stream.of( Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 5, rp.YouFMInfo[0]), - Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 10, rp.YouFMInfo[1]), - Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 14, rp.YouFMInfo[2]), - Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 18, rp.YouFMInfo[3]), - Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 20, rp.YouFMInfo[4]), - Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 22, rp.YouFMInfo[5]), - Arguments.of("Station info YouFm at 5:00 am", rp, "YouFM", 3, rp.YouFMInfo[6]) + 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]) ); } From 5885370fe321bede908b3baf3990fc0e9282dca3 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Thu, 17 Feb 2022 02:14:58 +0100 Subject: [PATCH 3/3] revised test for RadioPlayer getAntenneBYInfoByTime() --- src/test/java/device/radioPlayer/RadioPlayerTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index d409765..680109c 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -104,8 +104,9 @@ class RadioPlayerTest { @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("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); } static Stream infoByTimeOptions() { @@ -125,7 +126,12 @@ class RadioPlayerTest { 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 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]) ); }