@ -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 ) )
) ;
}
}