|
@ -378,7 +378,7 @@ class RadioPlayerTest { |
|
|
@ParameterizedTest |
|
|
@ParameterizedTest |
|
|
@MethodSource("getInfoTextOptions") |
|
|
@MethodSource("getInfoTextOptions") |
|
|
void testGetInfoText(String testName, String testTyp, RadioPlayer testRp, boolean expectedResult) { |
|
|
void testGetInfoText(String testName, String testTyp, RadioPlayer testRp, boolean expectedResult) { |
|
|
Boolean bool = null; |
|
|
|
|
|
|
|
|
Boolean bool; |
|
|
if(testTyp.equals("null")) bool = Strings.isNullOrEmpty(testRp.getInfoText()); |
|
|
if(testTyp.equals("null")) bool = Strings.isNullOrEmpty(testRp.getInfoText()); |
|
|
else if(testTyp.contains("station")) bool = testRp.getInfoText().contains(testRp.playedStation); |
|
|
else if(testTyp.contains("station")) bool = testRp.getInfoText().contains(testRp.playedStation); |
|
|
else if(testTyp.contains("region")) bool = testRp.getInfoText().contains("Regional playlist"); |
|
|
else if(testTyp.contains("region")) bool = testRp.getInfoText().contains("Regional playlist"); |
|
@ -386,6 +386,7 @@ class RadioPlayerTest { |
|
|
else if(testTyp.contains("savedNum")) bool = testRp.getInfoText().contains(("0") + testRp.savedPlaylist.indexOf(testRp.playedStation) + 1); |
|
|
else if(testTyp.contains("savedNum")) bool = testRp.getInfoText().contains(("0") + testRp.savedPlaylist.indexOf(testRp.playedStation) + 1); |
|
|
else if(testTyp.contains("regionNum")) bool = testRp.getInfoText().contains(("0") + testRp.regionPlaylist.indexOf(testRp.playedStation) + 1); |
|
|
else if(testTyp.contains("regionNum")) bool = testRp.getInfoText().contains(("0") + testRp.regionPlaylist.indexOf(testRp.playedStation) + 1); |
|
|
else if(testTyp.contains("stationInfo")) bool = testRp.getInfoText().contains("Now playing"); |
|
|
else if(testTyp.contains("stationInfo")) bool = testRp.getInfoText().contains("Now playing"); |
|
|
|
|
|
else bool = testRp.getInfoText().contains("Now playing"); |
|
|
|
|
|
|
|
|
assertThat(bool).describedAs(testName).isEqualTo(expectedResult); |
|
|
assertThat(bool).describedAs(testName).isEqualTo(expectedResult); |
|
|
} |
|
|
} |
|
@ -403,6 +404,8 @@ class RadioPlayerTest { |
|
|
rp5.next(); |
|
|
rp5.next(); |
|
|
RadioPlayer rp6 = new RadioPlayer(); |
|
|
RadioPlayer rp6 = new RadioPlayer(); |
|
|
rp6.changeRegion("BY"); |
|
|
rp6.changeRegion("BY"); |
|
|
|
|
|
RadioPlayer rp7 = new RadioPlayer(); |
|
|
|
|
|
rp7.next(); |
|
|
|
|
|
|
|
|
return Stream.of( |
|
|
return Stream.of( |
|
|
Arguments.of("Test for getInfoText is not empty or null", "null", rp, false), |
|
|
Arguments.of("Test for getInfoText is not empty or null", "null", rp, false), |
|
@ -411,7 +414,8 @@ class RadioPlayerTest { |
|
|
Arguments.of("Test for getInfoText contains saved playlist if played station is in it", "saved", rp3, true), |
|
|
Arguments.of("Test for getInfoText contains saved playlist if played station is in it", "saved", rp3, true), |
|
|
Arguments.of("Test for getInfoText contains station number in saved playlist", "savedNum", rp4, true), |
|
|
Arguments.of("Test for getInfoText contains station number in saved playlist", "savedNum", rp4, true), |
|
|
Arguments.of("Test for getInfoText contains station number in regional playlist", "regionNum", rp5, true), |
|
|
Arguments.of("Test for getInfoText contains station number in regional playlist", "regionNum", rp5, true), |
|
|
Arguments.of("Test for getInfoText contains station info if station has one", "stationInfo", rp6, true) |
|
|
|
|
|
|
|
|
Arguments.of("Test for getInfoText contains station info if station has one", "stationInfo", rp6, true), |
|
|
|
|
|
Arguments.of("Test for getInfoText not contains station info if station not has one", "noStationInfo", rp7, false) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |