Browse Source

test+productive code for case:2 of method prev in CDPlayer created.

feature-pr-cdPlayerPrev
JPANZO 3 years ago
parent
commit
ffd65cc96f
  1. 17
      src/test/java/device/cdPlayer/CDPlayerTest.java

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

@ -200,9 +200,19 @@ class CDPlayerTest {
@ParameterizedTest
@MethodSource("prevTestData")
void prevTest(String testName,String testDirection, CDPlayer _cdPlayer,int anzClicks, String expectedResult){
for (int i = 0; i <anzClicks; i++) {
if(testDirection.equals("StartingBySecondSong")) {
_cdPlayer.next();
for (int i = 0; i < anzClicks; i++) {
_cdPlayer.prev();
}
}
if(testDirection.equals("StartingByThirdSong")) {
_cdPlayer.next();
_cdPlayer.next();
for (int i = 0; i < anzClicks; i++) {
_cdPlayer.prev();
}
}
assertThat(_cdPlayer.getActualPlayTrack()).describedAs(testName).isEqualTo(expectedResult);
}
static Stream<Arguments> prevTestData () {
@ -214,10 +224,11 @@ class CDPlayerTest {
cdPlayer1.tapOnCdFlap();
cdPlayer1.setCD(audioCD);
cdPlayer1.tapOnCdFlap();
cdPlayer1.next();
return Stream.of(
Arguments.of("[getActualPlayTrack() after 1x prev() starting by secondSong] => FirstSongSelected", "FirstSongSelected", cdPlayer1, 1, cdPlayer1.getSongByNumber(0))
Arguments.of("[getActualPlayTrack() after 1x prev() starting by secondSong] => FirstSongSelected", "StartingBySecondSong", cdPlayer1, 1, cdPlayer1.getSongByNumber(0)),
Arguments.of("[getActualPlayTrack() after 2x prev() starting by thirdSong] => FirstSongSelected", "StartingByThirdSong", cdPlayer1, 2, cdPlayer1.getSongByNumber(0))
);
}
}
Loading…
Cancel
Save