Hỏi & Đáp
JunitParams 관련 질문 드립니다.
Junit5로 할때는 방법이 조금 바뀌었습니다. org.junit.jupiter junit-jupiter-params 5.4.2 test @ParameterizedTest @CsvSource ({ "0, 0, true" , "0, 100, false" , "100, 0, false" , }) public void testFree ( int basePrice , int maxPrice , boolean isFree) { Event event = Event. builder () .basePrice(basePrice) .maxPrice(maxPrice) .build() ; event.update() ; assertThat (event.isFree()).isEqualTo(isFree) ; } @ParameterizedTest @MethodSource ( "isOffline" ) public void testOffline (String location , boolean isOffline) { Event event = Event. builder () .location(location) .build() ; event.update() ; assertThat (event.isOffline()).isEqualTo(isOffline) ; } private static Stream isOffline () { return Stream. of ( Arguments. of ( " 강남역 " , true ) , Arguments. of ( null, false ) , Arguments. of ( "" , false ) ) ; }
- Lượt thích
- 3
- Số bình luận
- 3
- Lượt xem
- 6512

