Browse Source

Base-Test for method next created.

feature-pr-cdPlayerNextTest
JPANZO 3 years ago
parent
commit
64d051326d
  1. 8
      src/main/java/device/cdPlayer/CDPlayer.java
  2. 25
      src/test/java/device/cdPlayer/CDPlayerTest.java

8
src/main/java/device/cdPlayer/CDPlayer.java

@ -114,4 +114,12 @@ public class CDPlayer implements Device {
return false;
}
public String getSongByNumber(int songNr){
return "";
}
public String getActualPlayTrack() {
return actualPlayTrack;
}
}

25
src/test/java/device/cdPlayer/CDPlayerTest.java

@ -153,4 +153,29 @@ class CDPlayerTest {
);
}
@ParameterizedTest
@MethodSource("nextTestData")
void nextTest(String testName,String testDirection, CDPlayer _cdPlayer,int anzClicks, String expectedResult){
for (int i = 0; i < anzClicks; i++) {
_cdPlayer.next();
}
if(testDirection.equals("SecondSongSelected")){
assertThat(_cdPlayer.getActualPlayTrack()).describedAs(testName).isEqualTo(expectedResult);
}
}
static Stream<Arguments> nextTestData () {
String[] audioPlayList=new String[]{"Audio 01","Audio 02","Audio 03","Audio 04","Audio 05"};
CD audioCD=new CD("Audio",audioPlayList);
CDPlayer cdPlayer=new CDPlayer();
cdPlayer.tapOnCdFlap();
cdPlayer.setCD(audioCD);
cdPlayer.tapOnCdFlap();
return Stream.of(
Arguments.of("[getActualPlayTrack() after 1x next() starting by firstSong] => SecondSongSelected","SecondSongSelected", cdPlayer, 1, cdPlayer.getSongByNumber(1))
);
}
}
Loading…
Cancel
Save