Browse Source

Method mute of CDPlayer tested after 2x louder() by checkingTheVolume -> VolumeShouldBeSetTo0.

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

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

@ -112,6 +112,7 @@ public class CDPlayer implements Device {
@Override
public String mute() {
muted=true;
volume=0;
return ("Volume muted.");
}

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

@ -541,12 +541,19 @@ class CDPlayerTest {
_cdPlayer.mute();
assertThat(_cdPlayer.isMuted()).describedAs(testName).isEqualTo(true);
}
if(cases.equals("Case3")) {
_cdPlayer.louder();
_cdPlayer.louder();
_cdPlayer.mute();
assertThat(_cdPlayer.getVolume()).describedAs(testName).isEqualTo(0);
}
}
static Stream<Arguments> muteTestData () {
CDPlayer cdPlayer1 = new CDPlayer();
return Stream.of(
Arguments.of("[mute() by checkingTheReturnValue ] => ShouldReturnAString", "Case1", cdPlayer1, "Volume muted."),
Arguments.of("[mute() by checkingTheEffectAfterRun ] => VariableMutedShouldBeTrue", "Case2", cdPlayer1, "Volume muted.")
Arguments.of("[mute() by checkingTheEffectAfterRun ] => VariableMutedShouldBeTrue", "Case2", cdPlayer1, "Volume muted."),
Arguments.of("[mute() after 2x louder() by checkingTheVolume] => VolumeShouldBeSetTo0", "Case3", cdPlayer1, "Volume muted.")
);
}

Loading…
Cancel
Save