Browse Source

Method mute of CDPlayer tested on checkingTheReturnValue -> ShouldReturnAString.

feature-pr-jacksonsNewFeature
JPANZO 3 years ago
parent
commit
3f1d220ac8
  1. 2
      src/main/java/device/cdPlayer/CDPlayer.java
  2. 17
      src/test/java/device/cdPlayer/CDPlayerTest.java

2
src/main/java/device/cdPlayer/CDPlayer.java

@ -109,7 +109,7 @@ public class CDPlayer implements Device {
@Override
public String mute() {
return null;
return ("Volume muted.");
}
@Override

17
src/test/java/device/cdPlayer/CDPlayerTest.java

@ -493,7 +493,7 @@ class CDPlayerTest {
@ParameterizedTest
@MethodSource("addToFavoriteSongsData")
void addToFavoriteSongs(String testName,String cases, CDPlayer _cdPlayer,Exception exception) {
void addToFavoriteSongsTest(String testName,String cases, CDPlayer _cdPlayer,Exception exception) {
if(cases.equals("Case1")) {
String myFavoriteSong = _cdPlayer.getCD().getPlayList()[0];
_cdPlayer.addToFavoriteSongs(myFavoriteSong);
@ -531,4 +531,19 @@ class CDPlayerTest {
);
}
@ParameterizedTest
@MethodSource("muteTestData")
void muteTest(String testName,String cases, CDPlayer _cdPlayer,String expectedResult) {
assertThat(_cdPlayer.mute()).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> muteTestData () {
CDPlayer cdPlayer1 = new CDPlayer();
return Stream.of(
Arguments.of("[mute() by checkingTheReturnValue ] => ShouldReturnAString", "Case1", cdPlayer1, "Volume muted.")
);
}
}
Loading…
Cancel
Save