diff --git a/src/main/java/device/cdPlayer/CDPlayer.java b/src/main/java/device/cdPlayer/CDPlayer.java index 23714be..618bc1d 100644 --- a/src/main/java/device/cdPlayer/CDPlayer.java +++ b/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."); } diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index 1786fc8..2f4a4dc 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/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 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.") ); }