Browse Source

UsbPlayerTest.louderTest third Case

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

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

@ -116,10 +116,12 @@ public class UsbPlayer implements Device {
@Override
public void louder() {
if (Lautstaerke < 100) {
Lautstaerke += 1;
} else {
Lautstaerke = 100;
if(this.soundWas == -1) {
if (Lautstaerke < 100) {
Lautstaerke += 1;
} else {
Lautstaerke = 100;
}
}
}

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

@ -59,14 +59,25 @@ class UsbPlayerTest {
static Stream<Arguments> louderOptions() {
USB_Stick USBDrive = new USB_Stick();
//first case
UsbPlayer up11 = new UsbPlayer(USBDrive);
up11.louder();
//second case
UsbPlayer up22 = new UsbPlayer(USBDrive);
up22.setLautstaerke(100);
up22.louder();
//third case
UsbPlayer up3 = new UsbPlayer(USBDrive);
up3.setLautstaerke(100);
up3.mute();
up3.louder();
return Stream.of(
Arguments.of("Volume is : 1 ", up11, 1),
Arguments.of("Volume is : 100 ", up22, 100)
Arguments.of("Volume is : 100 ", up22, 100),
Arguments.of("Volume is muted,no change can be made ", up3, 0)
);
}

Loading…
Cancel
Save