From 20727f6e6055f22ca8a45b3ecf61c8f52a292585 Mon Sep 17 00:00:00 2001 From: sahar Date: Thu, 17 Feb 2022 21:28:10 +0100 Subject: [PATCH] UsbPlayerTest.muteTest third Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 2 +- src/test/java/device/usbPlayer/UsbPlayerTest.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 0b7a255..1ad1b54 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -184,7 +184,7 @@ public class UsbPlayer implements Device { @Override public String mute() { - + this.soundWas = getLautstaerke(); setLautstaerke(0); return "muted"; } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index 3663731..0bf968e 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -433,12 +433,14 @@ class UsbPlayerTest { @ParameterizedTest @MethodSource("muteOptions") - void muteTest(String testName, UsbPlayer inputUSB, String expectedResult,String testName2) { - + void muteTest(String testName, UsbPlayer inputUSB, String expectedResult,String testName2,String testName3) { + int prevSound = inputUSB.getLautstaerke(); String isMuted = inputUSB.mute(); assertThat(isMuted).describedAs(testName).isEqualTo(expectedResult); //Second case assertThat(inputUSB.getLautstaerke()).describedAs(testName2).isEqualTo(0); + //third case + assertThat(inputUSB.soundWas).describedAs(testName3).isEqualTo(prevSound); } @@ -451,7 +453,7 @@ class UsbPlayerTest { return Stream.of( - Arguments.of("The Sound is muted ", up1,"muted","Sound level is 0") + Arguments.of("The Sound is muted ", up1,"muted","Sound level is 0","previous sound level is saved ") ); }