Browse Source

added first test case for getItemList() & and added productive code for RadioPlayer

feature-pr-RadioPlayer-getItemList
Jan Ortner 3 years ago
parent
commit
d61ea26007
  1. 2
      src/main/java/device/radioPlayer/RadioPlayer.java
  2. 14
      src/test/java/device/radioPlayer/RadioPlayerTest.java

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

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

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

@ -320,4 +320,18 @@ 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")
);
}
@ParameterizedTest
@MethodSource("getItemListOptions")
void testGetItemList(String testName, RadioPlayer testRp, String[] expectedResult) {
String[] playList = testRp.getItemList();
assertThat(playList).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> getItemListOptions() {
RadioPlayer rp = new RadioPlayer();
return Stream.of(
Arguments.of("Test for return saved playlist", rp, rp.savedPlaylist.toArray(new String[0]))
);
}
}
Loading…
Cancel
Save