Browse Source

UsbPlayerTest.isAllAudioTestTest First Case

feature.pr-USB-NewTest
sahar 3 years ago
parent
commit
e68d22daf4
  1. 4
      src/main/java/device/usbPlayer/UsbPlayer.java
  2. 17
      src/test/java/device/usbPlayer/UsbPlayerTest.java

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

@ -69,14 +69,14 @@ public class UsbPlayer implements Device {
} }
//**********search method************* //**********search method*************
private boolean isAllAudio() {
public boolean isAllAudio() {
String song = ""; String song = "";
boolean flag = true; boolean flag = true;
for (int i = 0; i < Playlist.size(); i++) { for (int i = 0; i < Playlist.size(); i++) {
song = Playlist.get(i).substring(Playlist.get(i).length() - 4); song = Playlist.get(i).substring(Playlist.get(i).length() - 4);
if (song.equals(".mp3") | song.equals(".mp4") | song.equals(".wav")) {
if (song.equals(".mp3") ) {
flag = true; flag = true;
} else { } else {
flag = false; flag = false;

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

@ -242,5 +242,22 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) {
); );
} }
@ParameterizedTest
@MethodSource("isAllAudioOptions")
void isAllAudioTest(String testName, boolean inputTestResult, boolean expectedResult) {
// String current_Track = inputPlay.getPlayTrack();
assertThat(inputTestResult).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> isAllAudioOptions() {
UsbPlayer up1 = new UsbPlayer();
//up1.GoTo("Musik 03.mp3");
return Stream.of(
Arguments.of("Go to Song : Musik 03.mp3 ", up1.isAllAudio(), true)
);
}
} }
Loading…
Cancel
Save