Browse Source

UsbPlayerTest.muteTest Second Case

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

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

@ -12,6 +12,8 @@ public class UsbPlayer implements Device {
private Boolean isConnected;
private Boolean isDefect;
int Lautstaerke = 0;
int soundWas ;
public USB_Stick USBDrive = new USB_Stick();
public ArrayList<String> getPlaylist() {
@ -134,7 +136,7 @@ public class UsbPlayer implements Device {
@Override
public int getVolume() {
return 0;
return Lautstaerke;
}
@Override
@ -182,7 +184,9 @@ public class UsbPlayer implements Device {
@Override
public String mute() {
return null;
setLautstaerke(0);
return "muted";
}
@Override

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

@ -429,6 +429,31 @@ class UsbPlayerTest {
Arguments.of("USB Player with Albums ", up1,"USB Player is on : "+up1.getPlayTrack()),
Arguments.of("USB Player with no Albums ", up2,"USB Player with no Albums")
);
}//"muted"
@ParameterizedTest
@MethodSource("muteOptions")
void muteTest(String testName, UsbPlayer inputUSB, String expectedResult,String testName2) {
String isMuted = inputUSB.mute();
assertThat(isMuted).describedAs(testName).isEqualTo(expectedResult);
//Second case
assertThat(inputUSB.getLautstaerke()).describedAs(testName2).isEqualTo(0);
}
static Stream<Arguments> muteOptions() {
USB_Stick USBDrive = new USB_Stick();
//first case
UsbPlayer up1 = new UsbPlayer(USBDrive);
up1.mute();
return Stream.of(
Arguments.of("The Sound is muted ", up1,"muted","Sound level is 0")
);
}
}
Loading…
Cancel
Save