|
|
@ -391,18 +391,27 @@ class CDPlayerTest { |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("loadCDWechselerData") |
|
|
|
void loadCDWechselerTest(String testName,String cases, CDPlayer _cdPlayer,List<CD>cdList,Exception exception) { |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cdList)); |
|
|
|
assertEquals(CDWechselerNotRunningException.class, newException.getClass()); |
|
|
|
void loadCDWechselerTest(String testName,String cases, CDPlayer _cdPlayer,CD cd,Exception exception) { |
|
|
|
if(cases.equals("Case1")) { |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd)); |
|
|
|
assertEquals(CDWechselerNotRunningException.class, newException.getClass()); |
|
|
|
} |
|
|
|
if(cases.equals("Case2")) { |
|
|
|
_cdPlayer.changePlaySource(); |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd)); |
|
|
|
assertEquals(FormatNotSupportedException.class, newException.getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
static Stream<Arguments> loadCDWechselerData () { |
|
|
|
CDPlayer cdPlayer1 = new CDPlayer(); |
|
|
|
String[] videoPlayList=new String[]{"Video 01","Video 02","Video 03","Video 04","Video 05"}; |
|
|
|
String[] audioPlayList=new String[]{"Audio 01","Audio 02","Audio 03","Audio 04","Audio 05"}; |
|
|
|
CD audioCD1=new CD("Audio",audioPlayList); |
|
|
|
List<CD>CdList1=Arrays.asList(audioCD1); |
|
|
|
|
|
|
|
CD audioCD1=new CD("Audio",audioPlayList); |
|
|
|
CD DVD=new CD("DVD",videoPlayList); |
|
|
|
return Stream.of( |
|
|
|
Arguments.of("[loadCDWechseler() by notRunning=CDWechseler ] => shouldThrowAnException", "Case1", cdPlayer1,CdList1,new CDWechselerNotRunningException()) |
|
|
|
Arguments.of("[loadCDWechseler() by notRunning=CDWechseler ] => shouldThrowAnException", "Case1", cdPlayer1,audioCD1,new CDWechselerNotRunningException()), |
|
|
|
Arguments.of("[loadCDWechseler() by WrongCDFormat ] => shouldThrowAnException", "Case2", cdPlayer1,DVD,new FormatNotSupportedException()) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|