From 7e82d3206f572ef471f2bb1cd5cee96762d4b20d Mon Sep 17 00:00:00 2001 From: sahar Date: Mon, 31 Jan 2022 22:04:07 +0100 Subject: [PATCH] update the set of the Lautstaerke in the UsbPlayer class --- src/main/java/device/UsbPlayer.java | 20 +++++++++++--------- src/test/java/device/UsbPlayerTest.java | 5 +++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/device/UsbPlayer.java b/src/main/java/device/UsbPlayer.java index 827e486..539f37e 100644 --- a/src/main/java/device/UsbPlayer.java +++ b/src/main/java/device/UsbPlayer.java @@ -1,16 +1,18 @@ package device; -public class UsbPlayer implements Device{ +public class UsbPlayer implements Device { - private int Lautstaerke=0; + private int Lautstaerke = 0; - public void setLautstaerke(int ls){ - if(Lautstaerke < 100) { - Lautstaerke += 1; - } else { - Lautstaerke = 100; - } } - public int getLautstaerke(){return Lautstaerke;} + public void setLautstaerke(int ls) { + if (ls <= 100) { + Lautstaerke = ls; + } + } + + public int getLautstaerke() { + return Lautstaerke; + } @Override public void louder() { diff --git a/src/test/java/device/UsbPlayerTest.java b/src/test/java/device/UsbPlayerTest.java index 49b2ed2..80d47c9 100644 --- a/src/test/java/device/UsbPlayerTest.java +++ b/src/test/java/device/UsbPlayerTest.java @@ -8,11 +8,12 @@ class UsbPlayerTest { UsbPlayer up =new UsbPlayer(); -/* + @Test void louder() { + up.setLautstaerke(1); } - +/* @Test void quiter() { }