|
|
@ -7,6 +7,7 @@ import org.junit.jupiter.api.extension.ExtendWith; |
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
import org.mockito.Mockito; |
|
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
|
|
|
|
|
import java.lang.reflect.Method; |
|
|
@ -17,6 +18,8 @@ import java.util.stream.Stream; |
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
@ExtendWith(MockitoExtension.class) |
|
|
|
class CDPlayerTest { |
|
|
|
|
|
|
@ -272,4 +275,19 @@ class CDPlayerTest { |
|
|
|
assertThat(volumeIstInValueRange).isEqualTo(true); |
|
|
|
} |
|
|
|
|
|
|
|
@ParameterizedTest |
|
|
|
@MethodSource("getInfoTestData") |
|
|
|
void getInfoTest(String testName, CDPlayer _cdPlayer,Exception exception , String expectedResult){ |
|
|
|
Exception newException=assertThrows(exception.getClass(),()->_cdPlayer.getInfoText()); |
|
|
|
assertEquals(ReturnValueNullException.class, newException.getClass()); |
|
|
|
} |
|
|
|
static Stream<Arguments> getInfoTestData () { |
|
|
|
|
|
|
|
CDPlayer cdPlayer1 = new CDPlayer(); |
|
|
|
|
|
|
|
return Stream.of( |
|
|
|
Arguments.of("[getInfoText() by infoText=null ] => shouldThrowReturnValueNullException", cdPlayer1,new ReturnValueNullException(),"") |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
} |