diff --git a/src/main/java/device/cdPlayer/CDPlayer.java b/src/main/java/device/cdPlayer/CDPlayer.java index c33f53f..b08c602 100644 --- a/src/main/java/device/cdPlayer/CDPlayer.java +++ b/src/main/java/device/cdPlayer/CDPlayer.java @@ -121,6 +121,7 @@ public class CDPlayer implements Device { @Override public String unmute() { muted=false; + volume=oldVolume; return ("Volume unmute."); } diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index 67fbafc..988a878 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/src/test/java/device/cdPlayer/CDPlayerTest.java @@ -575,13 +575,22 @@ class CDPlayerTest { _cdPlayer.unmute(); assertThat(_cdPlayer.isMuted()).describedAs(testName).isEqualTo(false); } + if(cases.equals("Case3")) { + for (int i = 0; i < 5; i++) { + _cdPlayer.louder(); + } + _cdPlayer.mute(); + _cdPlayer.unmute(); + assertThat(_cdPlayer.isMuted()).describedAs(testName).isEqualTo(false); + assertThat(_cdPlayer.getVolume()).describedAs(testName).isEqualTo(5); + } } static Stream unmuteTestData () { CDPlayer cdPlayer1 = new CDPlayer(); - cdPlayer1.mute(); return Stream.of( Arguments.of("[unmute() by checkingTheReturnValue ] => ShouldReturnAString", "Case1", cdPlayer1, "Volume unmute."), - Arguments.of("[unmute() by checkingTheEffectAfterRun ] => VariableMutedShouldBeFalse", "Case2", cdPlayer1, "Volume unmute.") + Arguments.of("[unmute() by checkingTheEffectAfterRun ] => VariableMutedShouldBeFalse", "Case2", cdPlayer1, "Volume unmute."), + Arguments.of("[unmute() by 5x louder()-> mute()] => getVolumeShouldReturn_5", "Case3", cdPlayer1, "Volume unmute.") ); }