Browse Source

Merge remote-tracking branch 'origin/master'

feature-pr-USB-NextTest
sahar 3 years ago
parent
commit
88594dc43b
  1. 25
      src/main/java/device/RadioPlayer.java
  2. 15
      src/test/java/device/RadioPlayerTest.java

25
src/main/java/device/RadioPlayer.java

@ -1,7 +1,21 @@
package device;
import java.util.ArrayList;
public class RadioPlayer implements Device {
public RadioPlayer() {
super();
Playlist.add("Radio YouFM");
Playlist.add("Radio Teddy");
Playlist.add("Radio MegaHits");
playTrack=Playlist.get(0);
}
ArrayList<String> Playlist=new ArrayList<String>();
int Lautstaerke = 0;
String playTrack="";
public void setLautstaerke(int lautstaerke) {
Lautstaerke = lautstaerke;
}
@ -10,7 +24,7 @@ public class RadioPlayer implements Device {
return Lautstaerke;
}
int Lautstaerke = 0;
@Override
public void louder() {
if(Lautstaerke < 100) {
@ -35,12 +49,17 @@ public class RadioPlayer implements Device {
@Override
public void next() {
int currentIndex=Playlist.indexOf(playTrack);
int nextIndex=(currentIndex+1)%Playlist.size();
playTrack=Playlist.get(nextIndex);
}
@Override
public void prev() {
int currentIndex=Playlist.indexOf(playTrack);
int nextIndex=Playlist.size()-1;
if(currentIndex!=0){nextIndex=(currentIndex-1);}
playTrack=Playlist.get(nextIndex);
}
@Override

15
src/test/java/device/RadioPlayerTest.java

@ -36,22 +36,27 @@ class RadioPlayerTest {
assertThat(rp.getLautstaerke()).isEqualTo(0);
}
/*
Test3 for Jeninks Pipeline reaction to Pull request
hopefully last test2
test for pr only
@Test
void getVolume() {
}
*/
@Test
void next() {
rp.next();
int currentIndex=rp.Playlist.indexOf(rp.playTrack);
assertThat(rp.playTrack).isEqualTo(rp.Playlist.get((currentIndex)%rp.Playlist.size()));
}
@Test
void prev() {
}
rp.prev();
int currentIndex=rp.Playlist.indexOf(rp.playTrack);
assertThat(rp.playTrack).isEqualTo(rp.Playlist.get((currentIndex)%rp.Playlist.size()));
}
/*
@Test
void getInfoText() {
}

Loading…
Cancel
Save