From 43854c18e513abe5431cd8cf5f7efc5173e44c48 Mon Sep 17 00:00:00 2001 From: alpina0707 Date: Wed, 9 Feb 2022 19:18:36 +0100 Subject: [PATCH] added productive Code for louder if volume is max --- src/main/java/device/radioPlayer/RadioPlayer.java | 4 +++- src/test/java/device/radioPlayer/RadioPlayerTest.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/device/radioPlayer/RadioPlayer.java b/src/main/java/device/radioPlayer/RadioPlayer.java index f3b6b04..d731482 100644 --- a/src/main/java/device/radioPlayer/RadioPlayer.java +++ b/src/main/java/device/radioPlayer/RadioPlayer.java @@ -29,7 +29,9 @@ public class RadioPlayer implements Device { @Override public void louder() { - Lautstaerke+=1; + if(Lautstaerke < 100){ + Lautstaerke+=1;} + else Lautstaerke = 100; } @Override diff --git a/src/test/java/device/radioPlayer/RadioPlayerTest.java b/src/test/java/device/radioPlayer/RadioPlayerTest.java index 6952005..e5ba0fc 100644 --- a/src/test/java/device/radioPlayer/RadioPlayerTest.java +++ b/src/test/java/device/radioPlayer/RadioPlayerTest.java @@ -31,8 +31,8 @@ class RadioPlayerTest { rp2.setLautstaerke(100); rp2.louder(); return Stream.of( - Arguments.of("Test for one louder", rp1, 1), - Arguments.of("Test for one louder", rp2, 100) + Arguments.of("Test for one step louder", rp1, 1), + Arguments.of("Test for max louder", rp2, 100) ); }