From 945bb15abff248273a696718be6125f47b076517 Mon Sep 17 00:00:00 2001 From: sahar Date: Wed, 16 Feb 2022 00:08:25 +0100 Subject: [PATCH] UsbPlayerTest.GoToLastTest third Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 2 +- src/test/java/device/usbPlayer/UsbPlayerTest.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index d0dd39d..40d03fe 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -223,6 +223,6 @@ public class UsbPlayer implements Device { public void GoToLast() { //go to the last Song - setPlayTrack("Musik 03.mp3"); + setPlayTrack(this.getPlaylist().get(this.getPlaylist().size()-1)); } } diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index b649a16..1986521 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -352,11 +352,15 @@ class UsbPlayerTest { up2.GoToLast(); up2.GoToLast(); + UsbPlayer up3 = new UsbPlayer(); + up3.next(); + up3.GoToLast(); return Stream.of( - Arguments.of("It should go to the Last Song ", up1,"Musik 03.mp3"), - Arguments.of("It should go to the Last Song even after calling the function twice ", up2,"Musik 03.mp3") + Arguments.of("It should go to the Last Song ", up1,up3.getPlaylist().get(up3.getPlaylist().size()-1)), + Arguments.of("It should go to the Last Song even after calling the function twice ", up2,up3.getPlaylist().get(up3.getPlaylist().size()-1)), + Arguments.of("It should go to the Last Song even changing the current song ", up3,up3.getPlaylist().get(up3.getPlaylist().size()-1)) ); }