|
@ -114,7 +114,6 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//////////////// |
|
|
|
|
|
@ParameterizedTest |
|
|
@ParameterizedTest |
|
|
@MethodSource("PrevOptions") |
|
|
@MethodSource("PrevOptions") |
|
|
void PrevTest(String testName, UsbPlayer inputPlay, String expectedResult) { |
|
|
void PrevTest(String testName, UsbPlayer inputPlay, String expectedResult) { |
|
@ -137,4 +136,111 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("louder_10_Options") |
|
|
|
|
|
void louder_10_Test(String testName, UsbPlayer inputPlay, int expectedResult) { |
|
|
|
|
|
int volumeNum = inputPlay.getLautstaerke(); |
|
|
|
|
|
assertThat(volumeNum).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> louder_10_Options() { |
|
|
|
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
|
|
|
up1.Louder_10(); |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up2 = new UsbPlayer(); |
|
|
|
|
|
for (int i = 0; i <= 3; i++) { |
|
|
|
|
|
up2.Louder_10(); |
|
|
|
|
|
} |
|
|
|
|
|
up2.quieter_10(); |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up3 = new UsbPlayer(); |
|
|
|
|
|
up3.setLautstaerke(100); |
|
|
|
|
|
up3.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) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("quieter_10_Options") |
|
|
|
|
|
void quieter_10_Test(String testName, UsbPlayer inputPlay, int expectedResult) { |
|
|
|
|
|
int volumeNum = inputPlay.getLautstaerke(); |
|
|
|
|
|
assertThat(volumeNum).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> quieter_10_Options() { |
|
|
|
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
|
|
|
up1.setLautstaerke(10); |
|
|
|
|
|
up1.quieter_10(); |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up2 = new UsbPlayer(); |
|
|
|
|
|
up2.setLautstaerke(50); |
|
|
|
|
|
for (int i = 0; i < 3; i++) { |
|
|
|
|
|
up2.quieter_10(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up3 = new UsbPlayer(); |
|
|
|
|
|
up3.quieter_10(); |
|
|
|
|
|
|
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("Volume was 10, should be 0 ", up1, 0), |
|
|
|
|
|
Arguments.of("Volume was 50, should be 20 ", up2, 20), |
|
|
|
|
|
Arguments.of("Volume was 0, should stay 0 ", up3, 0) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("FindSongOptions") |
|
|
|
|
|
void findSongTest(String testName, int inputPlay, int expectedResult) { |
|
|
|
|
|
//first case: the song is not in the Album |
|
|
|
|
|
// int songLoc1 = inputPlay.findSong("song 4"); |
|
|
|
|
|
assertThat(inputPlay).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
//Second Case: the song is in the album |
|
|
|
|
|
// int songLoc2 = inputPlay.findSong("Musik 02"); |
|
|
|
|
|
assertThat(inputPlay).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> FindSongOptions() { |
|
|
|
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("The song is not in the Album", up1.findSong("song 4"), -1), |
|
|
|
|
|
Arguments.of("The song is in the Album", up1.findSong("Musik 02"), 1), |
|
|
|
|
|
Arguments.of("Name of the Song is in lower case :", up1.findSong("musik 02"), 1), |
|
|
|
|
|
Arguments.of("Name of the Song is in upper case :", up1.findSong("MUSIK 02"), 1) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("GoToOptions") |
|
|
|
|
|
void GoToTest(String testName, UsbPlayer inputPlay, String expectedResult) { |
|
|
|
|
|
String current_Track = inputPlay.getPlayTrack(); |
|
|
|
|
|
assertThat(current_Track).describedAs(testName).isEqualTo(expectedResult); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> GoToOptions() { |
|
|
|
|
|
UsbPlayer up1 = new UsbPlayer(); |
|
|
|
|
|
up1.GoTo("Musik 03.mp3"); |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up2 = new UsbPlayer(); |
|
|
|
|
|
up2.GoTo("Musik 04.mp3"); |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up3 = new UsbPlayer(); |
|
|
|
|
|
up3.GoTo("Musik 02"); |
|
|
|
|
|
|
|
|
|
|
|
UsbPlayer up4 = new UsbPlayer(); |
|
|
|
|
|
up4.next(); |
|
|
|
|
|
up4.GoTo("Musik"); |
|
|
|
|
|
|
|
|
|
|
|
return Stream.of( |
|
|
|
|
|
Arguments.of("Go to Song : Musik 03.mp3 ", up1, "Musik 03.mp3"), |
|
|
|
|
|
Arguments.of("Go to Song that is not in the Album: Musik 04.mp3 ", up2, "Musik 01.mp3"), |
|
|
|
|
|
Arguments.of("Go to Song without writing the full Name : Musik 02 ", up3, "Musik 02.mp3"), |
|
|
|
|
|
Arguments.of("Go to Song and write a Name that many songs starts with : Musik", up4, "Musik 01.mp3") |
|
|
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |