Browse Source

UsbPlayerTest.quieter_10_Test Forth Case

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

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

@ -136,9 +136,11 @@ public class UsbPlayer implements Device {
} }
public void quieter_10() { public void quieter_10() {
Lautstaerke -= 10;
if (Lautstaerke < 0) {
Lautstaerke = 0;
if(this.soundWas == -1) {
Lautstaerke -= 10;
if (Lautstaerke < 0) {
Lautstaerke = 0;
}
} }
} }

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

@ -240,10 +240,17 @@ class UsbPlayerTest {
UsbPlayer up3 = new UsbPlayer(USBDrive); UsbPlayer up3 = new UsbPlayer(USBDrive);
up3.quieter_10(); up3.quieter_10();
//forth case
UsbPlayer up4 = new UsbPlayer(USBDrive);
up4.setLautstaerke(11);
up4.mute();
up4.quieter_10();
return Stream.of( return Stream.of(
Arguments.of("Volume was 10, should be 0 ", up1, 0), Arguments.of("Volume was 10, should be 0 ", up1, 0),
Arguments.of("Volume was 50, should be 20 ", up2, 20), Arguments.of("Volume was 50, should be 20 ", up2, 20),
Arguments.of("Volume was 0, should stay 0 ", up3, 0)
Arguments.of("Volume was 0, should stay 0 ", up3, 0),
Arguments.of("Volume is muted,no change can be made ", up4, 0)
); );
} }

Loading…
Cancel
Save