|
@ -1,52 +1,17 @@ |
|
|
package device.usbPlayer; |
|
|
package device.usbPlayer; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
import java.util.stream.Stream; |
|
|
import java.util.stream.Stream; |
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
|
|
|
|
class UsbPlayerTest { |
|
|
class UsbPlayerTest { |
|
|
|
|
|
|
|
|
UsbPlayer up = new UsbPlayer(); |
|
|
UsbPlayer up = new UsbPlayer(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
@Test |
|
|
|
|
|
void getVolume() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void next() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void prev() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void getInfoText() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void getOptions() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void chooseOption() { |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
@ParameterizedTest |
|
|
@MethodSource("PlayOptions") |
|
|
@MethodSource("PlayOptions") |
|
|
void playTest(String testName, UsbPlayer inputPlay, String expectedResult) { |
|
|
void playTest(String testName, UsbPlayer inputPlay, String expectedResult) { |
|
@ -54,7 +19,6 @@ class UsbPlayerTest { |
|
|
assertThat(playState).describedAs(testName).isEqualTo(expectedResult); |
|
|
assertThat(playState).describedAs(testName).isEqualTo(expectedResult); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> PlayOptions() { |
|
|
static Stream<Arguments> PlayOptions() { |
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
UsbPlayer up8 = new UsbPlayer(); |
|
|
UsbPlayer up8 = new UsbPlayer(); |
|
@ -103,4 +67,23 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("quieterOptions") |
|
|
|
|
|
void quieterTest(String testName, UsbPlayer inputPlay, int expectedResult) { |
|
|
|
|
|
int volumeNum = inputPlay.getLautstaerke(); |
|
|
|
|
|
assertThat(volumeNum).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> quieterOptions() { |
|
|
|
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
|
|
|
up1.quieter(); |
|
|
|
|
|
UsbPlayer up2 = new UsbPlayer(); |
|
|
|
|
|
up2.setLautstaerke(10); |
|
|
|
|
|
up2.quieter(); |
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("Volume must stay 0 ", up1, 0), |
|
|
|
|
|
Arguments.of("Volume must be 9 ", up2, 9) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |