Browse Source

getOptions from CDPlayer tested on Returning Null.

changes in the Interface 0.3.
feature-pr-cdPlayerGetOptions
JPANZO 3 years ago
parent
commit
aa3c6ef4d4
  1. 2
      src/main/java/device/Device.java
  2. 6
      src/main/java/device/cdPlayer/CDPlayer.java
  3. 2
      src/main/java/device/radioPlayer/RadioPlayer.java
  4. 2
      src/main/java/device/usbPlayer/UsbPlayer.java
  5. 17
      src/test/java/device/cdPlayer/CDPlayerTest.java

2
src/main/java/device/Device.java

@ -14,7 +14,7 @@ public interface Device {
//get an Item of the Album
String chooseItem(int itemNr);
// get the actual album
String getItemList();
String[] getItemList();
String play();
}

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

@ -69,7 +69,7 @@ public class CDPlayer implements Device {
@Override
public String[] getOptions() {
return loadedCD.getPlayList();
return new String[]{};
}
@Override
@ -78,8 +78,8 @@ public class CDPlayer implements Device {
}
@Override
public String getItemList() {
return null;
public String[] getItemList() {
return loadedCD.getPlayList();
}
@Override

2
src/main/java/device/radioPlayer/RadioPlayer.java

@ -162,7 +162,7 @@ public class RadioPlayer implements Device {
}
@Override
public String getItemList() {
public String[] getItemList() {
return null;
}

2
src/main/java/device/usbPlayer/UsbPlayer.java

@ -156,7 +156,7 @@ public class UsbPlayer implements Device {
}
@Override
public String getItemList() {
public String[] getItemList() {
return null;
}

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

@ -193,7 +193,7 @@ class CDPlayerTest {
return Stream.of(
Arguments.of("[getActualPlayTrack() after 1x next() starting by firstSong] => SecondSongSelected","SecondSongSelected", cdPlayer1, 1, cdPlayer1.getSongByNumber(1)),
Arguments.of("[getActualPlayTrack() after 2x next() starting by firstSong] => ThirdSongSelected","ThirdSongSelected" ,cdPlayer2,2,cdPlayer2.getSongByNumber(2)),
Arguments.of("[getActualPlayTrack() after 1x next() starting by lastSong] => FirstSongSelected","FirstSongSelected", cdPlayer3,cdPlayer3.getOptions().length,cdPlayer3.getSongByNumber(0))
Arguments.of("[getActualPlayTrack() after 1x next() starting by lastSong] => FirstSongSelected","FirstSongSelected", cdPlayer3,cdPlayer3.getItemList().length,cdPlayer3.getSongByNumber(0))
);
}
@ -228,4 +228,19 @@ class CDPlayerTest {
Arguments.of("[getActualPlayTrack() after 1x prev() starting by firstSong] => FirstSongSelected", "StartingByFirstSong", cdPlayer1, 1, cdPlayer1.getSongByNumber(0))
);
}
@ParameterizedTest
@MethodSource("getOptionsTestData")
void getOptionsTest(String testName,String testDirection, CDPlayer _cdPlayer, String expectedResult){
assertThat(_cdPlayer.getOptions()).describedAs(testName).isNotEqualTo(null);
}
static Stream<Arguments> getOptionsTestData () {
CDPlayer cdPlayer1 = new CDPlayer();
return Stream.of(
Arguments.of("[getOptions(): shouldNotReturnsNull] => ReturnValueNotNull", "ReturnValueNotNull", cdPlayer1,null)
);
}
}
Loading…
Cancel
Save