|
@ -77,6 +77,7 @@ class RadioPlayerTest { |
|
|
RadioPlayer rp3 = new RadioPlayer(); |
|
|
RadioPlayer rp3 = new RadioPlayer(); |
|
|
RadioPlayer rp4 = new RadioPlayer(); |
|
|
RadioPlayer rp4 = new RadioPlayer(); |
|
|
RadioPlayer rp5 = new RadioPlayer(); |
|
|
RadioPlayer rp5 = new RadioPlayer(); |
|
|
|
|
|
RadioPlayer rp6 = new RadioPlayer(); |
|
|
rp1.next(); |
|
|
rp1.next(); |
|
|
rp2.next(); |
|
|
rp2.next(); |
|
|
rp2.prev(); |
|
|
rp2.prev(); |
|
@ -85,12 +86,17 @@ class RadioPlayerTest { |
|
|
rp4.next(); |
|
|
rp4.next(); |
|
|
rp5.changeRegion("BY"); |
|
|
rp5.changeRegion("BY"); |
|
|
rp5.prev(); |
|
|
rp5.prev(); |
|
|
|
|
|
rp6.changeRegion("BY"); |
|
|
|
|
|
rp6.saveStation(); |
|
|
|
|
|
rp6.next(); |
|
|
|
|
|
|
|
|
return Stream.of( |
|
|
return Stream.of( |
|
|
Arguments.of("Next Station Test for saved Stations", rp1, "Teddy"), |
|
|
Arguments.of("Next Station Test for saved Stations", rp1, "Teddy"), |
|
|
Arguments.of("Prev Station Test for saved Stations", rp2, "YouFM"), |
|
|
Arguments.of("Prev Station Test for saved Stations", rp2, "YouFM"), |
|
|
Arguments.of("Prev works on first Station for saved Stations", rp3, "MegaHits"), |
|
|
Arguments.of("Prev works on first Station for saved Stations", rp3, "MegaHits"), |
|
|
Arguments.of("changed Region and going to next station", rp4, "Bayern 1"), |
|
|
Arguments.of("changed Region and going to next station", rp4, "Bayern 1"), |
|
|
Arguments.of("changed Region and going to prev station", rp5, "Hit Radio N1") |
|
|
|
|
|
|
|
|
Arguments.of("changed Region and going to prev station", rp5, "Hit Radio N1"), |
|
|
|
|
|
Arguments.of("changed Region, saved station and going to next station", rp6, "YouFM") |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -187,21 +193,28 @@ class RadioPlayerTest { |
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
@ParameterizedTest |
|
|
@MethodSource("saveStationOptions") |
|
|
@MethodSource("saveStationOptions") |
|
|
void testSaveStation(String testName, RadioPlayer testRp, String expectedResult) { |
|
|
|
|
|
String savedStation = testRp.savedPlaylist.get(testRp.savedPlaylist.size() - 1); |
|
|
|
|
|
|
|
|
void testSaveStation(String testName, RadioPlayer testRp,String testTyp, String expectedResult) { |
|
|
|
|
|
String savedStation; |
|
|
|
|
|
if (testTyp == "normal") { |
|
|
|
|
|
savedStation = testRp.savedPlaylist.get(testRp.savedPlaylist.size() - 1);} |
|
|
|
|
|
else savedStation = Boolean.toString(testRp.regionPlaylist.isEmpty()); |
|
|
assertThat(savedStation).describedAs(testName).isEqualTo(expectedResult); |
|
|
assertThat(savedStation).describedAs(testName).isEqualTo(expectedResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static Stream<Arguments> saveStationOptions() { |
|
|
static Stream<Arguments> saveStationOptions() { |
|
|
RadioPlayer rp1 = new RadioPlayer(); |
|
|
RadioPlayer rp1 = new RadioPlayer(); |
|
|
RadioPlayer rp2 = new RadioPlayer(); |
|
|
RadioPlayer rp2 = new RadioPlayer(); |
|
|
|
|
|
RadioPlayer rp3 = new RadioPlayer(); |
|
|
rp1.changeRegion("BY"); |
|
|
rp1.changeRegion("BY"); |
|
|
rp1.saveStation(); |
|
|
rp1.saveStation(); |
|
|
rp2.saveStation(); |
|
|
rp2.saveStation(); |
|
|
|
|
|
rp3.changeRegion("BY"); |
|
|
|
|
|
rp3.saveStation(); |
|
|
|
|
|
|
|
|
return Stream.of( |
|
|
return Stream.of( |
|
|
Arguments.of("Test for saving station in saved playlist", rp1, "Antenne Bayern"), |
|
|
|
|
|
Arguments.of("Test for not saving station which is already in saved playlist", rp2, "MegaHits") |
|
|
|
|
|
|
|
|
Arguments.of("Test for saving station in saved playlist", rp1, "normal", "Antenne Bayern"), |
|
|
|
|
|
Arguments.of("Test for not saving station which is already in saved playlist", rp2, "normal", "MegaHits"), |
|
|
|
|
|
Arguments.of("Test for after saving station jump back to saved playlist", rp3, "jump", "true") |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|