Browse Source

UsbPlayerTest.unmuteTest second Case

feature-pr-USB-otherTests
sahar 3 years ago
parent
commit
a7c3ea8610
  1. 1
      src/main/java/device/usbPlayer/UsbPlayer.java
  2. 9
      src/test/java/device/usbPlayer/UsbPlayerTest.java

1
src/main/java/device/usbPlayer/UsbPlayer.java

@ -192,6 +192,7 @@ public class UsbPlayer implements Device {
@Override @Override
public String unmute() { public String unmute() {
setLautstaerke(soundWas);
return "unmuted"; return "unmuted";
} }

9
src/test/java/device/usbPlayer/UsbPlayerTest.java

@ -458,22 +458,23 @@ class UsbPlayerTest {
@ParameterizedTest @ParameterizedTest
@MethodSource("unmuteOptions") @MethodSource("unmuteOptions")
void unmuteTest(String testName, UsbPlayer inputUSB, String expectedResult) {
void unmuteTest(String testName, UsbPlayer inputUSB, String expectedResult,String testName2) {
int prevSound = inputUSB.getLautstaerke();
String unMuted = inputUSB.unmute(); String unMuted = inputUSB.unmute();
//first case //first case
assertThat(unMuted).describedAs(testName).isEqualTo(expectedResult); assertThat(unMuted).describedAs(testName).isEqualTo(expectedResult);
//Second case
assertThat(inputUSB.getLautstaerke()).describedAs(testName2).isEqualTo(prevSound);
} }
static Stream<Arguments> unmuteOptions() { static Stream<Arguments> unmuteOptions() {
USB_Stick USBDrive = new USB_Stick(); USB_Stick USBDrive = new USB_Stick();
UsbPlayer up1 = new UsbPlayer(USBDrive); UsbPlayer up1 = new UsbPlayer(USBDrive);
up1.unmute(); up1.unmute();
return Stream.of( return Stream.of(
Arguments.of("The Sound is unmuted ", up1,"unmuted")
Arguments.of("The Sound is unmuted ", up1,"unmuted","Sound level has changed")
); );
} }

Loading…
Cancel
Save