Browse Source

added first test case for changeToSavedPlaylist() & and added productive code

feature-pr-changeToSavedPlaylist
Jan Ortner 3 years ago
parent
commit
5d52b2f721
  1. 3
      src/main/java/device/radioPlayer/RadioPlayer.java
  2. 17
      src/test/java/device/radioPlayer/RadioPlayerTest.java

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

@ -202,4 +202,7 @@ public class RadioPlayer implements Device {
} else return " Last Station: 01 " + station + " can´t by deleted"; } else return " Last Station: 01 " + station + " can´t by deleted";
} }
public String changeToSavedPlaylist() {
return "You are already in saved Playlist!";
}
} }

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

@ -244,4 +244,21 @@ class RadioPlayerTest {
Arguments.of("Test for not delete station in saved playlist if this is the last station", rp1, "noDelete", true) Arguments.of("Test for not delete station in saved playlist if this is the last station", rp1, "noDelete", true)
); );
} }
@ParameterizedTest
@MethodSource("changeToSavedPlaylistOptions")
void testChangeToSavedPlaylist(String testName, RadioPlayer testRp, String expectedResult) {
String savedStation = testRp.playedStation;
assertThat(savedStation).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> changeToSavedPlaylistOptions() {
RadioPlayer rp = new RadioPlayer();
rp.changeToSavedPlaylist();
return Stream.of(
Arguments.of("Test for change to saved playlist when you already in saved playlist", rp, "YouFM")
);
}
} }
Loading…
Cancel
Save