From 74242d1cb56c19f9f495e8f83bff632b578377ea Mon Sep 17 00:00:00 2001 From: JPANZO Date: Tue, 15 Feb 2022 18:48:39 +0100 Subject: [PATCH] changes in the Interface. --- src/main/java/device/Device.java | 6 +----- src/main/java/device/cdPlayer/CDPlayer.java | 7 +++---- src/main/java/device/radioPlayer/RadioPlayer.java | 5 ++--- src/main/java/device/usbPlayer/UsbPlayer.java | 5 ++--- src/test/java/device/cdPlayer/CDPlayerTest.java | 2 +- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/main/java/device/Device.java b/src/main/java/device/Device.java index 621e540..47162d9 100644 --- a/src/main/java/device/Device.java +++ b/src/main/java/device/Device.java @@ -8,12 +8,8 @@ public interface Device { void next(); void prev(); String getInfoText(); - //returns an array with Method-Names to bee listed String[] getOptions(); - //returns an array with contents to bee played - String[] getItemList(); - + String chooseOption(); String play(); - } diff --git a/src/main/java/device/cdPlayer/CDPlayer.java b/src/main/java/device/cdPlayer/CDPlayer.java index 618159d..b332775 100644 --- a/src/main/java/device/cdPlayer/CDPlayer.java +++ b/src/main/java/device/cdPlayer/CDPlayer.java @@ -69,15 +69,14 @@ public class CDPlayer implements Device { @Override public String[] getOptions() { - return new String[0]; + return loadedCD.getPlayList(); } @Override - public String[] getItemList() { - return loadedCD.getPlayList(); + public String chooseOption() { + return null; } - @Override public String play() { if(isCdFlapOpen()){ diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index 73d5625..6a6363d 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -157,11 +157,10 @@ public class RadioPlayer implements Device { } @Override - public String[] getItemList() { - return new String[0]; + public String chooseOption() { + return null; } - @Override public String play() { if (regionPlaylist.contains(playedStation)) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 1f395c8..1856068 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -151,11 +151,10 @@ public class UsbPlayer implements Device { } @Override - public String[] getItemList() { - return new String[0]; + public String chooseOption() { + return null; } - @Override public String play() { String result = "USB : "; diff --git a/src/test/java/device/cdPlayer/CDPlayerTest.java b/src/test/java/device/cdPlayer/CDPlayerTest.java index d26aa95..37cb277 100644 --- a/src/test/java/device/cdPlayer/CDPlayerTest.java +++ b/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.getItemList().length,cdPlayer3.getSongByNumber(0)) + Arguments.of("[getActualPlayTrack() after 1x next() starting by lastSong] => FirstSongSelected","FirstSongSelected", cdPlayer3,cdPlayer3.getOptions().length,cdPlayer3.getSongByNumber(0)) ); }