Browse Source

UsbPlayerTest.louder_10_Test Forth Case

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

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

@ -126,10 +126,13 @@ public class UsbPlayer implements Device {
}
public void Louder_10() {
Lautstaerke += 10;
if (Lautstaerke > 100) {
Lautstaerke = 100;
if(this.soundWas == -1) {
Lautstaerke += 10;
if (Lautstaerke > 100) {
Lautstaerke = 100;
}
}
}
public void quieter_10() {

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

@ -185,22 +185,29 @@ class UsbPlayerTest {
static Stream<Arguments> louder_10_Options() {
USB_Stick USBDrive = new USB_Stick();
//first case
UsbPlayer up1 = new UsbPlayer(USBDrive);
up1.Louder_10();
//Second case
UsbPlayer up2 = new UsbPlayer(USBDrive);
for (int i = 0; i <= 3; i++) {
for (int i = 0; i < 3; i++) {
up2.Louder_10();
}
up2.quieter_10();
//third case
UsbPlayer up3 = new UsbPlayer(USBDrive);
up3.setLautstaerke(100);
up3.Louder_10();
//forth case
UsbPlayer up4 = new UsbPlayer(USBDrive);
up4.setLautstaerke(10);
up4.mute();
up4.Louder_10();
return Stream.of(
Arguments.of("Volume was 0, should be 10 ", up1, 10),
Arguments.of("Volume was 0, should be 30 ", up2, 30),
Arguments.of("Volume was 100, should stay 100 ", up3, 100)
Arguments.of("Volume was 100, should stay 100 ", up3, 100),
Arguments.of("Volume is muted,no change can be made ", up4, 0)
);
}

Loading…
Cancel
Save