From 308057ae4b4f1079f8d28efef51a49851190d3a0 Mon Sep 17 00:00:00 2001 From: sahar Date: Wed, 16 Feb 2022 00:26:38 +0100 Subject: [PATCH] UsbPlayerTest.setPlayTrackTest Third Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 5 +++-- src/test/java/device/usbPlayer/UsbPlayerTest.java | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index dc82c32..2e5a2bf 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -43,8 +43,9 @@ public class UsbPlayer implements Device { } public void setPlayTrack(String playTrack) { - if(this.findSong(playTrack) != -1) - this.playTrack = playTrack; + if(this.findSong(playTrack) != -1){ + this.playTrack = playTrack;} + else System.out.println("The Song does not exist in the Albume"); } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index c23080b..6aea624 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -380,9 +380,14 @@ class UsbPlayerTest { UsbPlayer up2 = new UsbPlayer(); up2.setPlayTrack("Musik 02.mp3"); + //Third Case + UsbPlayer up3 = new UsbPlayer(); + up3.setPlayTrack("Musik 04.mp3"); + return Stream.of( 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") + Arguments.of("It should change the current Song if it is in the Albume", up2,"Musik 02.mp3"), + Arguments.of("Tried to change the Song,but the Song name does not exist in the Album(No change)", up3,"Musik 01.mp3") ); }