|
|
@ -196,11 +196,11 @@ class RadioPlayerTest { |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("saveStationOptions") |
|
|
|
void testSaveStation(String testName, RadioPlayer testRp,String testTyp, String expectedResult) { |
|
|
|
void testSaveStation(String testName, RadioPlayer testRp, String testTyp, String expectedResult) { |
|
|
|
String savedStation; |
|
|
|
if (testTyp.equals("normal")) { |
|
|
|
savedStation = testRp.savedPlaylist.get(testRp.savedPlaylist.size() - 1);} |
|
|
|
else savedStation = Boolean.toString(testRp.regionPlaylist.isEmpty()); |
|
|
|
savedStation = testRp.savedPlaylist.get(testRp.savedPlaylist.size() - 1); |
|
|
|
} else savedStation = Boolean.toString(testRp.regionPlaylist.isEmpty()); |
|
|
|
assertThat(savedStation).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
} |
|
|
|
|
|
|
@ -221,4 +221,27 @@ class RadioPlayerTest { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("deleteStationOptions") |
|
|
|
void testDeleteStation(String testName, RadioPlayer testRp, String testTyp, Boolean expectedResult) { |
|
|
|
Boolean savedStation; |
|
|
|
if (testTyp.equals("delete")) { |
|
|
|
savedStation = testRp.savedPlaylist.contains("YouFM"); |
|
|
|
} else savedStation = testRp.savedPlaylist.contains("MegaHits"); |
|
|
|
assertThat(savedStation).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
} |
|
|
|
|
|
|
|
static Stream<Arguments> deleteStationOptions() { |
|
|
|
RadioPlayer rp = new RadioPlayer(); |
|
|
|
rp.deleteStation(); |
|
|
|
RadioPlayer rp1 = new RadioPlayer(); |
|
|
|
rp1.deleteStation(); |
|
|
|
rp1.deleteStation(); |
|
|
|
rp1.deleteStation(); |
|
|
|
|
|
|
|
return Stream.of( |
|
|
|
Arguments.of("Test for delete station in saved playlist", rp, "delete", false), |
|
|
|
Arguments.of("Test for not delete station in saved playlist if this is the last station", rp1, "noDelete", true) |
|
|
|
); |
|
|
|
} |
|
|
|
} |