From a715cbd3537a1b5df0e9f3f25e6435645976967d Mon Sep 17 00:00:00 2001 From: sahar Date: Fri, 18 Feb 2022 17:18:31 +0100 Subject: [PATCH] UsbPlayerTest.playTest first case --- src/main/java/device/usbPlayer/UsbPlayer.java | 23 ++----------------- .../java/device/usbPlayer/UsbPlayerTest.java | 22 +----------------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index acf923b..586e53a 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -230,27 +230,8 @@ public class UsbPlayer implements Device { @Override public String play() { - String result = "USB : "; - if (isConnected == true) { - result += "connected,"; - if (isDefect == false) { - result += "working"; - if (this.Playlist.size() != 0) { - result += ",have a list"; - if (this.isAllAudio()) { - result += ",Audio"; - if (!playTrack.equals("")) - result += ",point to a track."; - else - result += ",doesn't point to a track."; - } else { - result += ",not Audio."; - } - } else result += ",have no list."; - } else { - result += "not working."; - } - } else result = "not connected."; + String result = "USB Device plays"; + return result; } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index 6aea624..1b35ea7 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -22,30 +22,10 @@ class UsbPlayerTest { static Stream PlayOptions() { UsbPlayer up1 = new UsbPlayer(); - UsbPlayer up8 = new UsbPlayer(); - up8.setPlayTrack(""); - UsbPlayer up2 = new UsbPlayer(); - ArrayList l = new ArrayList(); - l.add("a.mp3"); - l.add("b.mp3"); - l.add("c.gif"); - up2.setPlaylist(l); - UsbPlayer up3 = new UsbPlayer(); - ArrayList Pl = new ArrayList(); - up3.setPlaylist(Pl); - UsbPlayer up6 = new UsbPlayer(); - up6.setDefect(true); - UsbPlayer up7 = new UsbPlayer(); - up7.setConnected(false); return Stream.of( - Arguments.of("All right : ", up1, "USB : connected,working,have a list,Audio,point to a track."), - Arguments.of("No first Track : ", up8, "USB : connected,working,have a list,Audio,doesn't point to a track."), - Arguments.of("No Audio Files : ", up2, "USB : connected,working,have a list,not Audio."), - Arguments.of("No list of tracks : ", up3, "USB : connected,working,have no list."), - Arguments.of("connected , not working : ", up6, "USB : connected,not working."), - Arguments.of("not connected : ", up7, "not connected.")); + Arguments.of("All right : ", up1, "USB Device plays")); }