Browse Source

UsbPlayerTest.louderTest third Case

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

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

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

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

@ -59,14 +59,25 @@ class UsbPlayerTest {
static Stream<Arguments> louderOptions() { static Stream<Arguments> louderOptions() {
USB_Stick USBDrive = new USB_Stick(); USB_Stick USBDrive = new USB_Stick();
//first case
UsbPlayer up11 = new UsbPlayer(USBDrive); UsbPlayer up11 = new UsbPlayer(USBDrive);
up11.louder(); up11.louder();
//second case
UsbPlayer up22 = new UsbPlayer(USBDrive); UsbPlayer up22 = new UsbPlayer(USBDrive);
up22.setLautstaerke(100); up22.setLautstaerke(100);
up22.louder(); up22.louder();
//third case
UsbPlayer up3 = new UsbPlayer(USBDrive);
up3.setLautstaerke(100);
up3.mute();
up3.louder();
return Stream.of( return Stream.of(
Arguments.of("Volume is : 1 ", up11, 1), 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