Browse Source

PullRequest for RadioPlayer function prev

feature-pr-rp_prev
Jan Ortner 3 years ago
parent
commit
1f04f62a72
  1. 5
      src/main/java/device/RadioPlayer.java
  2. 8
      src/test/java/device/RadioPlayerTest.java

5
src/main/java/device/RadioPlayer.java

@ -56,7 +56,10 @@ public class RadioPlayer implements Device {
@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

8
src/test/java/device/RadioPlayerTest.java

@ -47,12 +47,16 @@ class RadioPlayerTest {
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