From 959a6a3a5e2b82dcdf10916f3a9e364dff5230f0 Mon Sep 17 00:00:00 2001 From: sahar Date: Fri, 11 Feb 2022 21:43:17 +0100 Subject: [PATCH] UsbPlayerTest.louder_10_Test() third Case --- src/main/java/device/usbPlayer/UsbPlayer.java | 3 +++ src/test/java/device/usbPlayer/UsbPlayerTest.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index 925e55b..d259fa9 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -106,6 +106,9 @@ public class UsbPlayer implements Device { public void Louder_10(){ Lautstaerke += 10; + if (Lautstaerke > 100) { + Lautstaerke = 100; + } } @Override diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index 722f74e..e2801e1 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -150,10 +150,14 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { for (int i = 0; i < 3; i++) {//3 up2.Louder_10(); } + UsbPlayer up3 = new UsbPlayer(); + up3.setLautstaerke(100); + up3.Louder_10(); return Stream.of( Arguments.of("Volume was 0, should 10 ", up1, 10), - Arguments.of("Volume was increased 3 times :30 ", up2, 30) + Arguments.of("Volume was increased 3 times :30 ", up2, 30), + Arguments.of("Volume is 100 and doesn't change ", up3, 100) ); }