Programming/Test3 [Java, 테스트] - Junit5, Assertions 기본 설명 출처 : 더 자바, 애플리케이션을 테스트하는 다양한 방법 - 백기선 Assertions Assertions is a collection of utility methods that support asserting conditions in tests. Unless otherwise noted, a failed assertion will throw an AssertionFailedError or a subclass thereof. 주요 메서드 assertThat(기대, 값, 에러시 출력할 메시지) 실제값이 기댓값과 일치하는지 테스트한다. assertEquals(StudyStatus.DRAFT, study.getStatus(), ()-> "should be draft"); // 스터디가 생기면 초기 상태가 DR.. 2021. 3. 15. [Java, 테스트] - Junit5 기본 설명 Junit5 JUnit(제이유닛)은 자바 프로그래밍 언어용 유닛 테스트 프레임워크이다. JUnit은 테스트 주도 개발 면에서 중요하며 SUnit과 함께 시작된 XUnit이라는 이름의 유닛 테스트 프레임워크 계열의 하나이다. JUnit 5 =JUnit Platform+JUnit Jupiter+JUnit Vintage The JUnit Platform serves as a foundation for launching testing frameworks on the JVM. It also defines the TestEngine API for developing a testing framework that runs on the platform. Furthermore, the platform provides a .. 2021. 3. 14. [Java, 테스트 코드] - 테스트 코드(미완성) @Test @DisplayName("VIP는 10% 할인이 적용되어야 한다. ") void vip_0(){ //given Member member = new Member(1L, "memberVIP", Grade.VIP); //when int discount = discountPolicy.discount(member, 10000); //then Assertions.assertThat(discount).isEqualTo(1000); } Assertj 라이브러리 Assertionpjh3749.tistory.com/241 [AssertJ] JUnit과 같이 쓰기 좋은 AssertJ 필수 부분 정리 AssertJ가 core document를 새로운 github.io로 이전했네요 :) . 본 글은 AssertJ 공.. 2021. 3. 4. 이전 1 다음