Browse Source

Merge branch 'feature-pr-USB-Louder' into feature-dev-USB-PlayTest

feature-dev-USB-PlayTest
sahar 3 years ago
parent
commit
73adadc224
  1. 32
      src/test/java/device/usbPlayer/UsbPlayerTest.java

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

@ -16,19 +16,6 @@ class UsbPlayerTest {
UsbPlayer up = new UsbPlayer();
@Test
void louder_test() {
up.setLautstaerke(40);
up.louder();
assertThat(up.getLautstaerke()).isEqualTo(41);
}
@Test
void quieter_test() {
up.setLautstaerke(40);
up.quieter();
assertThat(up.getLautstaerke()).isEqualTo(39);
}
/*
@Test
void getVolume() {
@ -61,6 +48,7 @@ class UsbPlayerTest {
assertThat(playState).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> PlayOptions() {
UsbPlayer up1 = new UsbPlayer();
UsbPlayer up8 = new UsbPlayer();
@ -87,6 +75,24 @@ class UsbPlayerTest {
Arguments.of("No list of tracks : ", up3, "USB : connected,working,have no list."),
Arguments.of("connected , not working : ", up6, "USB : connected,not working."),
Arguments.of("not connected : ", up7, "not connected.")
@ParameterizedTest
@MethodSource("louderOptions")
void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) {
int volumeNum = inputPlay.getLautstaerke();
assertThat(volumeNum).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> louderOptions() {
UsbPlayer up1 = new UsbPlayer();
up1.louder();
UsbPlayer up2 = new UsbPlayer();
up2.setLautstaerke(100);
up2.louder();
return Stream.of(
Arguments.of("Volume is : 1 ", up1, 1),
Arguments.of("Volume is : 100 ", up2, 100)
);
}
}
Loading…
Cancel
Save