|
|
@ -431,14 +431,31 @@ class CDPlayerTest { |
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("changeToNextCDData") |
|
|
|
void changeToNextCDTest(String testName,String cases, CDPlayer _cdPlayer,Exception exception) { |
|
|
|
if(cases.equals("Case1")) { |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.changeToNextCD()); |
|
|
|
assertEquals(ChangeCDOnlyOnCDWechselerException.class, newException.getClass()); |
|
|
|
} |
|
|
|
if(cases.equals("Case2")) { |
|
|
|
CD actualCD=_cdPlayer.getCD(); |
|
|
|
_cdPlayer.changeToNextCD(); |
|
|
|
CD nextCD=_cdPlayer.getCD(); |
|
|
|
assertThat(nextCD).describedAs(testName).isNotEqualTo(null); |
|
|
|
} |
|
|
|
} |
|
|
|
static Stream<Arguments> changeToNextCDData () { |
|
|
|
CDPlayer cdPlayer1 = new CDPlayer(); |
|
|
|
|
|
|
|
CDPlayer cdPlayer2 = new CDPlayer(); |
|
|
|
cdPlayer2.changePlaySource(); |
|
|
|
|
|
|
|
String[] audioPlayList=new String[]{"Audio 01","Audio 02","Audio 03","Audio 04","Audio 05"}; |
|
|
|
CD audioCD1=new CD("Audio",audioPlayList); |
|
|
|
cdPlayer2.loadCDWechseler(audioCD1,0); |
|
|
|
cdPlayer2.loadCDWechseler(audioCD1,1); |
|
|
|
|
|
|
|
return Stream.of( |
|
|
|
Arguments.of("[changeToNextCD() by CDWechselerNotSelected ] => shouldThrowAnException", "Case1", cdPlayer1,new ChangeCDOnlyOnCDWechselerException()) |
|
|
|
Arguments.of("[changeToNextCD() by CDWechselerNotSelected ] => shouldThrowAnException", "Case1", cdPlayer1,new ChangeCDOnlyOnCDWechselerException()), |
|
|
|
Arguments.of("[changeToNextCD() checking the effect ] => loadedCDShouldNotReturnNull", "Case2", cdPlayer2,null) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|