|
|
@ -393,19 +393,24 @@ class CDPlayerTest { |
|
|
|
@MethodSource("loadCDWechselerData") |
|
|
|
void loadCDWechselerTest(String testName,String cases, CDPlayer _cdPlayer,CD cd,Exception exception) { |
|
|
|
if(cases.equals("Case1")) { |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd)); |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd,0)); |
|
|
|
assertEquals(CDWechselerNotRunningException.class, newException.getClass()); |
|
|
|
} |
|
|
|
if(cases.equals("Case2")) { |
|
|
|
_cdPlayer.changePlaySource(); |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd)); |
|
|
|
Exception newException = assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd,0)); |
|
|
|
assertEquals(FormatNotSupportedException.class, newException.getClass()); |
|
|
|
} |
|
|
|
if(cases.equals("Case3")) { |
|
|
|
_cdPlayer.changePlaySource(); |
|
|
|
_cdPlayer.loadCDWechseler(cd); |
|
|
|
int length=_cdPlayer.getCdWechseler().getCDList().size(); |
|
|
|
assertThat(length).describedAs(testName).isEqualTo(1); |
|
|
|
_cdPlayer.loadCDWechseler(cd,0); |
|
|
|
CD firstCD=_cdPlayer.getCdWechseler().getCDList()[0]; |
|
|
|
assertThat(firstCD).describedAs(testName).isNotEqualTo(null); |
|
|
|
} |
|
|
|
if(cases.equals("Case4")) { |
|
|
|
_cdPlayer.changePlaySource(); |
|
|
|
Exception newException=assertThrows(exception.getClass(), () -> _cdPlayer.loadCDWechseler(cd, 12)); |
|
|
|
assertEquals(MaxCapacityExceededException.class, newException.getClass()); |
|
|
|
} |
|
|
|
} |
|
|
|
static Stream<Arguments> loadCDWechselerData () { |
|
|
@ -418,7 +423,8 @@ class CDPlayerTest { |
|
|
|
return Stream.of( |
|
|
|
Arguments.of("[loadCDWechseler() by notRunning=CDWechseler ] => shouldThrowAnException", "Case1", cdPlayer1,audioCD1,new CDWechselerNotRunningException()), |
|
|
|
Arguments.of("[loadCDWechseler() by WrongCDFormat ] => shouldThrowAnException", "Case2", cdPlayer1,DVD,new FormatNotSupportedException()), |
|
|
|
Arguments.of("[loadCDWechseler() by leadingFirstCD ] => CDListOfCDWechselerShouldHaveLength1", "Case3", cdPlayer1,audioCD1,null) |
|
|
|
Arguments.of("[loadCDWechseler() by leadingFirstCD ] => CDListOfCDWechselerShouldHaveLength1", "Case3", cdPlayer1,audioCD1,null), |
|
|
|
Arguments.of("[loadCDWechseler() by MaxCapacityExceeded:Max=10 ] => shouldThrowAnException", "Case4", cdPlayer1,audioCD1,new MaxCapacityExceededException()) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|