From 9366de1be110b6cc6e8ca26f3c44e497742f01eb Mon Sep 17 00:00:00 2001 From: JPANZO Date: Tue, 8 Feb 2022 21:28:01 +0100 Subject: [PATCH] CDPlayer-Methods[play,louder] update. --- .../java/device/cdPlayer/CDPlayerTest.java | 38 ++++++++++--------- .../java/device/usbPlayer/UsbPlayerTest.java | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index 43358dd..7126d3e 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/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 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") - ); - } } \ No newline at end of file diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index ae3bc85..f5c1962 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/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) ); } - */ + } \ No newline at end of file