@ -197,4 +197,29 @@ class CDPlayerTest {
) ;
}
@ParameterizedTest
@MethodSource ( "prevTestData" )
void prevTest ( String testName , String testDirection , CDPlayer _cdPlayer , int anzClicks , String expectedResult ) {
for ( int i = 0 ; i < anzClicks ; i + + ) {
_cdPlayer . prev ( ) ;
}
assertThat ( _cdPlayer . getActualPlayTrack ( ) ) . describedAs ( testName ) . isEqualTo ( expectedResult ) ;
}
static Stream < Arguments > prevTestData ( ) {
String [ ] audioPlayList = new String [ ] { "Audio 01" , "Audio 02" , "Audio 03" , "Audio 04" , "Audio 05" } ;
CD audioCD = new CD ( "Audio" , audioPlayList ) ;
CDPlayer cdPlayer1 = new CDPlayer ( ) ;
cdPlayer1 . tapOnCdFlap ( ) ;
cdPlayer1 . setCD ( audioCD ) ;
cdPlayer1 . tapOnCdFlap ( ) ;
cdPlayer1 . next ( ) ; / / 1x nach Vorne
return Stream . of (
Arguments . of ( "[getActualPlayTrack() after 1x prev() starting by firstSong] => FirstSongSelected" , "FirstSongSelected" , cdPlayer1 , 1 , cdPlayer1 . getSongByNumber ( 0 ) )
) ;
}
}