From 648baabab07b10a93edf862e43efb65b44b52054 Mon Sep 17 00:00:00 2001 From: sahar Date: Wed, 16 Feb 2022 00:21:47 +0100 Subject: [PATCH] UsbPlayerTest.setPlayTrackTest Second Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 1 + src/test/java/device/usbPlayer/UsbPlayerTest.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 40d03fe..dc82c32 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -43,6 +43,7 @@ public class UsbPlayer implements Device { } public void setPlayTrack(String playTrack) { + if(this.findSong(playTrack) != -1) this.playTrack = playTrack; } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index b44afb5..c23080b 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -376,8 +376,13 @@ class UsbPlayerTest { UsbPlayer up1 = new UsbPlayer(); up1.setPlayTrack("Musik 02.mp3"); + //Second Case + UsbPlayer up2 = new UsbPlayer(); + up2.setPlayTrack("Musik 02.mp3"); + return Stream.of( - Arguments.of("It should change the current Song ", up1,"Musik 02.mp3") + Arguments.of("It should change the current Song ", up1,"Musik 02.mp3"), + Arguments.of("It should change the current Song if it is in the Albume", up2,"Musik 02.mp3") ); }