Browse Source

CDPlayer-Methods[play,louder] update.

feature-pr-organization
JPANZO 3 years ago
parent
commit
9366de1be1
  1. 38
      src/test/java/device/cdPlayer/CDPlayerTest.java
  2. 2
      src/test/java/device/usbPlayer/UsbPlayerTest.java

38
src/test/java/device/cdPlayer/CDPlayerTest.java

@ -77,6 +77,26 @@ class CDPlayerTest {
cdPlayer9.tapOnCdFlap();
cdPlayer9.setCD(audioCD3);
cdPlayer9.tapOnCdFlap();
CDPlayer cdPlayer10=new CDPlayer();
cdPlayer10.tapOnCdFlap();
cdPlayer10.setCD(audioCD4);
cdPlayer10.tapOnCdFlap();
return Stream.of(
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isEmpty] => NoCD", cdPlayer1, new NoCDException(), "CD must be set."),
Arguments.of("[CdFlap has been Opened and Closed, CdDriveContent=>isEmpty] => NoCD", cdPlayer2,new NoCDException(),"CD must be set."),
Arguments.of("[CdFlap=isOpen , CdDriveContent=>isEmpty] => CdFlapIsOpen", cdPlayer3,new CdFlapIsOpenException(),"Cd Flap must be closed."),
Arguments.of("[CdFlap=isOpen , CdDriveContent=>isSet] => CdFlapIsOpen", cdPlayer4,new CdFlapIsOpenException(),"Cd Flap must be closed."),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>DVD] => FormatNotSupported",cdPlayer5,new FormatNotSupportedException(),"Cd-Format not supported."),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>Blue-ray] => FormatNotSupported",cdPlayer6, new FormatNotSupportedException(),"Cd-Format not supported."),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>Audio] => AllConditionsForPlayMet", cdPlayer7,null,"AllConditionsForPlayMet"),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>MP3] => AllConditionsForPlayMet", cdPlayer8,null,"AllConditionsForPlayMet"),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>WMA] => AllConditionsForPlayMet", cdPlayer9,null,"AllConditionsForPlayMet"),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>AAC] => AllConditionsForPlayMet", cdPlayer10,null,"AllConditionsForPlayMet")
);
}
@ParameterizedTest
@MethodSource("louderTestData")
void louderTest(String testName,String testDirection, CDPlayer _cdPlayer,int anzClicks, int expectedResult) {
@ -92,11 +112,6 @@ class CDPlayerTest {
assertThat(_cdPlayer.getVolume()).describedAs(testName).isNotEqualTo(expectedResult);
}
}
CDPlayer cdPlayer10=new CDPlayer();
cdPlayer10.tapOnCdFlap();
cdPlayer10.setCD(audioCD4);
cdPlayer10.tapOnCdFlap();
static Stream<Arguments> louderTestData () {
CDPlayer cdPlayer=new CDPlayer();
return Stream.of(
@ -106,18 +121,5 @@ class CDPlayerTest {
);
}
return Stream.of(
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isEmpty] => NoCD", cdPlayer1, new NoCDException(), "CD must be set."),
Arguments.of("[CdFlap has been Opened and Closed, CdDriveContent=>isEmpty] => NoCD", cdPlayer2,new NoCDException(),"CD must be set."),
Arguments.of("[CdFlap=isOpen , CdDriveContent=>isEmpty] => CdFlapIsOpen", cdPlayer3,new CdFlapIsOpenException(),"Cd Flap must be closed."),
Arguments.of("[CdFlap=isOpen , CdDriveContent=>isSet] => CdFlapIsOpen", cdPlayer4,new CdFlapIsOpenException(),"Cd Flap must be closed."),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>DVD] => FormatNotSupported",cdPlayer5,new FormatNotSupportedException(),"Cd-Format not supported."),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>Blue-ray] => FormatNotSupported",cdPlayer6, new FormatNotSupportedException(),"Cd-Format not supported."),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>Audio] => AllConditionsForPlayMet", cdPlayer7,null,"AllConditionsForPlayMet"),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>MP3] => AllConditionsForPlayMet", cdPlayer8,null,"AllConditionsForPlayMet"),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>WMA] => AllConditionsForPlayMet", cdPlayer9,null,"AllConditionsForPlayMet"),
Arguments.of("[CdFlap=isClosed , CdDriveContent=>isSet, CdFormat=>AAC] => AllConditionsForPlayMet", cdPlayer10,null,"AllConditionsForPlayMet")
);
}
}

2
src/test/java/device/usbPlayer/UsbPlayerTest.java

@ -76,5 +76,5 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) {
Arguments.of("Volume is : 100 ", up2, 100)
);
}
*/
}
Loading…
Cancel
Save