From d917a294b402628849aaf7a6f35078a8997e96d0 Mon Sep 17 00:00:00 2001 From: JPANZO Date: Fri, 11 Feb 2022 15:41:58 +0100 Subject: [PATCH] Test+Productive code for case:2 of method-test next created. --- src/main/java/device/cdPlayer/CDPlayer.java | 3 ++- src/test/java/device/cdPlayer/CDPlayerTest.java | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/device/cdPlayer/CDPlayer.java b/src/main/java/device/cdPlayer/CDPlayer.java index ff1caf2..8ef629f 100644 --- a/src/main/java/device/cdPlayer/CDPlayer.java +++ b/src/main/java/device/cdPlayer/CDPlayer.java @@ -44,8 +44,9 @@ public class CDPlayer implements Device { public void next() { List playList = Arrays.asList(loadedCD.getPlayList()); int indexOfActualPlayTrack=playList.indexOf(actualPlayTrack); - + System.out.println("indexOfActualPlayTrack="+indexOfActualPlayTrack); this.actualPlayTrack=playList.get(indexOfActualPlayTrack +1); + System.out.println("nextSong= "+actualPlayTrack); } @Override diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index 694460a..a3054e9 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/src/test/java/device/cdPlayer/CDPlayerTest.java @@ -159,9 +159,9 @@ class CDPlayerTest { for (int i = 0; i < anzClicks; i++) { _cdPlayer.next(); } - if(testDirection.equals("SecondSongSelected")){ + //if(testDirection.equals("SecondSongSelected")){ assertThat(_cdPlayer.getActualPlayTrack()).describedAs(testName).isEqualTo(expectedResult); - } + //} } static Stream nextTestData () { @@ -172,9 +172,11 @@ class CDPlayerTest { cdPlayer.tapOnCdFlap(); cdPlayer.setCD(audioCD); cdPlayer.tapOnCdFlap(); + System.out.println(cdPlayer.getActualPlayTrack()); 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)) ); }