diff --git a/src/main/java/device/usbPlayer/UsbPlayer.java b/src/main/java/device/usbPlayer/UsbPlayer.java index d259fa9..c2f51f7 100644 --- a/src/main/java/device/usbPlayer/UsbPlayer.java +++ b/src/main/java/device/usbPlayer/UsbPlayer.java @@ -111,6 +111,10 @@ public class UsbPlayer implements Device { } } + public void quieter_10(){ + Lautstaerke -= 10; + } + @Override public int getVolume() { return 0; diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index e2801e1..03e1a50 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -136,28 +136,21 @@ void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { ); } + @ParameterizedTest - @MethodSource("louder_10_Options") - void louder_10_Test(String testName, UsbPlayer inputPlay, int expectedResult) { + @MethodSource("quieter_10_Options") + void quieter_10_Test(String testName, UsbPlayer inputPlay, int expectedResult) { int volumeNum = inputPlay.getLautstaerke(); assertThat(volumeNum).describedAs(testName).isEqualTo(expectedResult); } - static Stream louder_10_Options() { + static Stream quieter_10_Options() { UsbPlayer up1 = new UsbPlayer(); - up1.Louder_10(); - UsbPlayer up2 = new UsbPlayer(); - for (int i = 0; i < 3; i++) {//3 - up2.Louder_10(); - } - UsbPlayer up3 = new UsbPlayer(); - up3.setLautstaerke(100); - up3.Louder_10(); + up1.setLautstaerke(10); + up1.quieter_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 is 100 and doesn't change ", up3, 100) + Arguments.of("Volume was 10, should be 0 ", up1, 0) ); }