@ -61,8 +60,8 @@ public class RadioPlayer implements Device {
String[]AntenneBYInfo={"ANTENNE BAYERN Guten Morgen Bayern","ANTENNE BAYERN bei der Arbeit","ANTENNE BAYERN am Nachmittag","ANTENNE BAYERN am Abend","ANTENNE BAYERN Hit-Nacht"};
publicvoidsetLautstaerke(intlautstaerke){
Lautstaerke=lautstaerke;
publicvoidsetVolume(intvolume){
this.volume=volume;
}
publicvoidchangeRegion(Stringregion){
@ -96,21 +95,21 @@ public class RadioPlayer implements Device {
@Override
publicvoidlouder(){
if(Lautstaerke<100){
Lautstaerke+=1;
}elseLautstaerke=100;
if(volume<100){
volume+=1;
}elsevolume=100;
}
@Override
publicvoidquieter(){
if(Lautstaerke>0){
Lautstaerke-=1;
}elseLautstaerke=0;
if(volume>0){
volume-=1;
}elsevolume=0;
}
@Override
publicintgetVolume(){
returnLautstaerke;
returnvolume;
}
@Override
@ -149,12 +148,22 @@ public class RadioPlayer implements Device {
Arguments.of("Test select station in saved playlist to play with nr isn`t bigger than playlist size",rp,"Teddy"),
Arguments.of("Test select station in saved playlist to play with nr is bigger than playlist size. Last station in playlist gets played",rp1,"MegaHits"),
@ -244,7 +230,6 @@ class RadioPlayerTest {
rp2.saveStation();
rp3.changeRegion("BY");
rp3.saveStation();
returnStream.of(
Arguments.of("Test for saving station in saved playlist",rp1,"normal","Antenne Bayern"),
Arguments.of("Test for not saving station which is already in saved playlist",rp2,"normal","MegaHits"),
@ -269,7 +254,6 @@ class RadioPlayerTest {
rp1.deleteStation();
rp1.deleteStation();
rp1.deleteStation();
returnStream.of(
Arguments.of("Test for delete station in saved playlist",rp,"delete",false),
Arguments.of("Test for not delete station in saved playlist if this is the last station",rp1,"noDelete",true)
@ -289,7 +273,6 @@ class RadioPlayerTest {
RadioPlayerrp1=newRadioPlayer();
rp1.changeRegion("BY");
rp1.changeToSavedPlaylist();
returnStream.of(
Arguments.of("Test for change to saved playlist when you already in saved playlist",rp,"YouFM"),
Arguments.of("Test for change to saved playlist when in regional playlist",rp1,"YouFM")
@ -313,7 +296,6 @@ class RadioPlayerTest {
RadioPlayerrp2=newRadioPlayer();
rp2.next();
rp2.changeOrderInSavedPlaylist(-1);
returnStream.of(
Arguments.of("Test for change order in saved playlist with nr isn`t bigger than playlist size",rp,0,"Teddy"),
Arguments.of("Test for change order in saved playlist with nr is than bigger playlist size put at the end of playlist",rp1,2,"YouFM"),
@ -336,7 +318,6 @@ class RadioPlayerTest {
RadioPlayerrp=newRadioPlayer();
RadioPlayerrp1=newRadioPlayer();
rp1.changeRegion("BY");
returnStream.of(
Arguments.of("Test for return saved playlist",rp,"saved",rp.savedPlaylist.toArray(newString[0])),
Arguments.of("Test for return regional playlist",rp1,"region",rp1.regionPlaylist.toArray(newString[0]))
@ -354,23 +335,90 @@ class RadioPlayerTest {
staticStream<Arguments>muteOptions(){
RadioPlayerrp=newRadioPlayer();
rp.setLautstaerke(25);
rp.setVolume(25);
rp.mute();
RadioPlayerrp1=newRadioPlayer();
rp1.setLautstaerke(30);
rp1.setVolume(30);
rp1.mute();
returnStream.of(
Arguments.of("Test for mute RadioPlayer if volume is actually 0","actual",rp,0),
Arguments.of("Test for mute RadioPlayer if volume is saved before muting","saved",rp1,30)
);
}
@Test
voidTestUnmute(){
voidtestUnmute(){
RadioPlayerrp=newRadioPlayer();
rp.setLautstaerke(40);
rp.setVolume(40);
rp.mute();
rp.unmute();
assertThat(rp.getVolume()).describedAs("Test if unmute is setting the saved volume").isEqualTo(rp.savedVolume);