Browse Source

Merge commit 'b7b79badda3d9c14f0fa7360b8256ec51fe3cde0' into HEAD

feature-pr-RadioPlayer-mute
Jenkins 3 years ago
parent
commit
75f23114b2
  1. 5
      src/main/java/device/radioPlayer/RadioPlayer.java
  2. 22
      src/test/java/device/radioPlayer/RadioPlayerTest.java

5
src/main/java/device/radioPlayer/RadioPlayer.java

@ -185,7 +185,10 @@ public class RadioPlayer implements Device {
@Override @Override
public String[] getItemList() { public String[] getItemList() {
return null;
if (regionPlaylist.contains(playedStation))
return regionPlaylist.toArray(new String[0]);
else
return savedPlaylist.toArray(new String[0]);
} }
@Override @Override

22
src/test/java/device/radioPlayer/RadioPlayerTest.java

@ -320,4 +320,26 @@ class RadioPlayerTest {
Arguments.of("Test for change order in saved playlist with nr is than smaller than 0 at front of playlist", rp2, 0, "Teddy") Arguments.of("Test for change order in saved playlist with nr is than smaller than 0 at front of playlist", rp2, 0, "Teddy")
); );
} }
@ParameterizedTest
@MethodSource("getItemListOptions")
void testGetItemList(String testName, RadioPlayer testRp, String testTyp, String[] expectedResult) {
if (testTyp.equals("region")) {
testRp.changeRegion("BY");
}
String[] playList = testRp.getItemList();
assertThat(playList).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> getItemListOptions() {
RadioPlayer rp = new RadioPlayer();
RadioPlayer rp1 = new RadioPlayer();
rp1.changeRegion("BY");
return Stream.of(
Arguments.of("Test for return saved playlist", rp, "saved", rp.savedPlaylist.toArray(new String[0])),
Arguments.of("Test for return regional playlist", rp1, "region", rp1.regionPlaylist.toArray(new String[0]))
);
}
} }
Loading…
Cancel
Save