From 86b5cca88c10fce0fa5a920c5dd2d48874bc4e9c Mon Sep 17 00:00:00 2001 From: sahar Date: Mon, 7 Feb 2022 20:26:29 +0100 Subject: [PATCH] LouderTest implemented --- .../java/device/usbPlayer/UsbPlayerTest.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/test/java/device/usbPlayer/UsbPlayerTest.java b/src/test/java/device/usbPlayer/UsbPlayerTest.java index bf170fe..25eaef1 100644 --- a/src/test/java/device/usbPlayer/UsbPlayerTest.java +++ b/src/test/java/device/usbPlayer/UsbPlayerTest.java @@ -1,6 +1,12 @@ package device.usbPlayer; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.ArrayList; +import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.*; import static org.assertj.core.api.Assertions.assertThat; @@ -47,9 +53,23 @@ class UsbPlayerTest { @Test void chooseOption() { } +*/ +@ParameterizedTest +@MethodSource("louderOptions") +void louderTest(String testName, UsbPlayer inputPlay, int expectedResult) { + int volumeNum = inputPlay.getLautstaerke(); + assertThat(volumeNum).describedAs(testName).isEqualTo(expectedResult); +} - @Test - void play() { + static Stream louderOptions() { + UsbPlayer up1 = new UsbPlayer(); + up1.louder(); + UsbPlayer up2 = new UsbPlayer(); + up2.setLautstaerke(100); + up2.louder(); + return Stream.of( + Arguments.of("Volume is : 1 ", up1, 1), + Arguments.of("Volume is : 100 ", up2, 100) + ); } - */ } \ No newline at end of file