From de82f475dd2f7f7453406f886519043de7ea7998 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Wed, 16 Feb 2022 21:32:19 +0100 Subject: [PATCH] added test case for unmute() & and added productive code for RadioPlayer --- src/main/java/device/radioPlayer/RadioPlayer.java | 3 ++- src/test/java/device/radioPlayer/RadioPlayerTest.java | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index a510fef..2b91e3e 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -201,7 +201,8 @@ public class RadioPlayer implements Device { @Override public String unmute() { - return null; + setLautstaerke(savedVolume); + return ("RadioPlayer is unmuted Volume is set to " + getVolume()); } diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index 2570bb1..ac5eefc 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -365,4 +365,12 @@ class RadioPlayerTest { Arguments.of("Test for mute RadioPlayer if volume is saved before muting", "saved", rp1, 30) ); } + @Test + void TestUnmute() { + RadioPlayer rp = new RadioPlayer(); + rp.setLautstaerke(40); + rp.mute(); + rp.unmute(); + assertThat(rp.getVolume()).describedAs("Test if unmute is setting the saved volume").isEqualTo(rp.savedVolume); + } } \ No newline at end of file