Browse Source

Test+Productive code for case:2 of method-test next created.

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

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

@ -44,8 +44,9 @@ public class CDPlayer implements Device {
public void next() { public void next() {
List<String> playList = Arrays.asList(loadedCD.getPlayList()); List<String> playList = Arrays.asList(loadedCD.getPlayList());
int indexOfActualPlayTrack=playList.indexOf(actualPlayTrack); int indexOfActualPlayTrack=playList.indexOf(actualPlayTrack);
System.out.println("indexOfActualPlayTrack="+indexOfActualPlayTrack);
this.actualPlayTrack=playList.get(indexOfActualPlayTrack +1); this.actualPlayTrack=playList.get(indexOfActualPlayTrack +1);
System.out.println("nextSong= "+actualPlayTrack);
} }
@Override @Override

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

@ -159,9 +159,9 @@ class CDPlayerTest {
for (int i = 0; i < anzClicks; i++) { for (int i = 0; i < anzClicks; i++) {
_cdPlayer.next(); _cdPlayer.next();
} }
if(testDirection.equals("SecondSongSelected")){
//if(testDirection.equals("SecondSongSelected")){
assertThat(_cdPlayer.getActualPlayTrack()).describedAs(testName).isEqualTo(expectedResult); assertThat(_cdPlayer.getActualPlayTrack()).describedAs(testName).isEqualTo(expectedResult);
}
//}
} }
static Stream<Arguments> nextTestData () { static Stream<Arguments> nextTestData () {
@ -172,9 +172,11 @@ class CDPlayerTest {
cdPlayer.tapOnCdFlap(); cdPlayer.tapOnCdFlap();
cdPlayer.setCD(audioCD); cdPlayer.setCD(audioCD);
cdPlayer.tapOnCdFlap(); cdPlayer.tapOnCdFlap();
System.out.println(cdPlayer.getActualPlayTrack());
return Stream.of( return Stream.of(
Arguments.of("[getActualPlayTrack() after 1x next() starting by firstSong] => SecondSongSelected","SecondSongSelected", cdPlayer, 1, cdPlayer.getSongByNumber(1))
Arguments.of("[getActualPlayTrack() after 1x next() starting by firstSong] => SecondSongSelected","SecondSongSelected", cdPlayer, 1, cdPlayer.getSongByNumber(1)),
Arguments.of("[getActualPlayTrack() after 2x next() starting by firstSong] => ThirdSongSelected","ThirdSongSelected" ,cdPlayer,1,cdPlayer.getSongByNumber(2))
); );
} }
Loading…
Cancel
Save