Browse Source

Method getInfoText of CDPlayer tested on MessageShouldContainInfoAboutDevice.

feature-pr-RadioPlayer-getOptions
JPANZO 3 years ago
parent
commit
f51c6d783c
  1. 2
      src/main/java/device/cdPlayer/CDPlayer.java
  2. 6
      src/test/java/device/cdPlayer/CDPlayerTest.java

2
src/main/java/device/cdPlayer/CDPlayer.java

@ -162,7 +162,7 @@ public class CDPlayer implements Device {
} }
public void setInfoText() { public void setInfoText() {
this.infoText="CDPlayer: Item->"+actualPlayTrack+" from Album->"+this.loadedCD.getAlbumName()+" running.";
this.infoText=this.getClass().getSimpleName()+": Item->"+actualPlayTrack+" from Album->"+this.loadedCD.getAlbumName()+" running.";
} }

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

@ -300,6 +300,9 @@ class CDPlayerTest {
String albumName= _cdPlayer.getCD().getAlbumName(); String albumName= _cdPlayer.getCD().getAlbumName();
assertThat(_cdPlayer.getInfoText().contains(albumName)).describedAs(testName).isEqualTo(true); assertThat(_cdPlayer.getInfoText().contains(albumName)).describedAs(testName).isEqualTo(true);
} }
if(cases.equals("Case5")) {
assertThat(_cdPlayer.getInfoText().contains("CDPlayer")).describedAs(testName).isEqualTo(true);
}
} }
static Stream<Arguments> getInfoTestData () { static Stream<Arguments> getInfoTestData () {
@ -319,7 +322,8 @@ class CDPlayerTest {
Arguments.of("[getInfoText() by infoText=null ] => shouldThrowReturnValueNullException","Case1", cdPlayer1,new ReturnValueNullException(),""), Arguments.of("[getInfoText() by infoText=null ] => shouldThrowReturnValueNullException","Case1", cdPlayer1,new ReturnValueNullException(),""),
Arguments.of("[getInfoText() by infoText=null ] => ExceptionShouldReturnAMessage","Case2",cdPlayer1,new ReturnValueNullException(),"Method should not return a Null-Value."), Arguments.of("[getInfoText() by infoText=null ] => ExceptionShouldReturnAMessage","Case2",cdPlayer1,new ReturnValueNullException(),"Method should not return a Null-Value."),
Arguments.of("[getInfoText() by infoText=Message ] => MessageShouldContainInfoOfActualPlayTrack","Case3",cdPlayer2,null,""), Arguments.of("[getInfoText() by infoText=Message ] => MessageShouldContainInfoOfActualPlayTrack","Case3",cdPlayer2,null,""),
Arguments.of("[getInfoText() by infoText=Message ] => MessageShouldContainInfoAboutAlbum","Case4",cdPlayer2,null,"")
Arguments.of("[getInfoText() by infoText=Message ] => MessageShouldContainInfoAboutAlbum","Case4",cdPlayer2,null,""),
Arguments.of("[getInfoText() by infoText=Message ] => MessageShouldContainInfoAboutDevice","Case5",cdPlayer2,null,"")
); );
} }
Loading…
Cancel
Save