assertTrue(isPresent()) method

인철·2023년 10월 12일
0

Spring

목록 보기
2/48

assertTrue(isPresent()) method

assertTrue()isPresent() method는 모두 검사의 역할을 하지만 서로 다른 목적과 상황에서 사용됨
isPresent()는 optional객체를 검사하고
assertTrue()는 테스트 케이스에서 예상 조건을 검사할 때 사용됨

즉, isPresent()로 optional 객체가 값이 채워져 있는지 확인하고
assertTrue()로 이 조건을 확인하고 조건이 false이면 AssertionError를 발생시켜 테스트를 실패로 표시함
profile
같은글이있어도양해부탁드려요(킁킁)

0개의 댓글