반응형
Source annotation
@ValueSource -> Array of values: Strings, ints, doubles, floats etc
@CsvSource -> Array of CSV String values
@CsvFileSource -> CSV values read from a file
@EnumSource -> Enum constant values
@MethodSoruce -> Custom method for providing values
//sample
@DispleName("Testing with Small data file")
@PrameterizedTest(name="value={0}, expected={1}") //0번째 인덱스의 값이 1
@CsvFileSource(resources="/test-data.csv") //src/test/resources/test-data.csv
@Order(2)
void testTestDataFile(int value, String expected) {
assertEquals(expected, TestDemo.compute(value));
}
반응형
'SpringBoot' 카테고리의 다른 글
Spring boot Mockito Example - @Mock & @InjectMocks (0) | 2022.05.22 |
---|---|
Spring boot Test with Mockito (0) | 2022.05.22 |
Java Conditional Unit Test (0) | 2022.05.21 |
spring aop (0) | 2021.11.07 |
Spring mvc async rest api (0) | 2021.11.07 |