Browse Source

Method mute of CDPlayer tested on checkingTheEffectAfterRun -> VariableMutedShouldBeFalse.

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

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

@ -120,6 +120,7 @@ public class CDPlayer implements Device {
@Override
public String unmute() {
muted=false;
return ("Volume unmute.");
}

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

@ -568,12 +568,20 @@ class CDPlayerTest {
@ParameterizedTest
@MethodSource("unmuteTestData")
void unmuteTest(String testName,String cases, CDPlayer _cdPlayer,String expectedResult) {
assertThat(_cdPlayer.unmute()).describedAs(testName).isEqualTo(expectedResult);
if(cases.equals("Case1")) {
assertThat(_cdPlayer.unmute()).describedAs(testName).isEqualTo(expectedResult);
}
if(cases.equals("Case2")) {
_cdPlayer.unmute();
assertThat(_cdPlayer.isMuted()).describedAs(testName).isEqualTo(false);
}
}
static Stream<Arguments> unmuteTestData () {
CDPlayer cdPlayer1 = new CDPlayer();
cdPlayer1.mute();
return Stream.of(
Arguments.of("[unmute() by checkingTheReturnValue ] => ShouldReturnAString", "Case1", cdPlayer1, "Volume unmute.")
Arguments.of("[unmute() by checkingTheReturnValue ] => ShouldReturnAString", "Case1", cdPlayer1, "Volume unmute."),
Arguments.of("[unmute() by checkingTheEffectAfterRun ] => VariableMutedShouldBeFalse", "Case2", cdPlayer1, "Volume unmute.")
);
}

Loading…
Cancel
Save