Skip to content

Commit

Permalink
[test] SignUpCustomerServiceIntegrationTest 수정
Browse files Browse the repository at this point in the history
- DataIntegrityViolationException 를 서비스 레이어에서 잡지 못하면 에러 명시된 출럭
  • Loading branch information
kimhyun5u committed Aug 14, 2024
1 parent 21e06d6 commit e280c79
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.dao.DataIntegrityViolationException;

import camp.woowak.lab.customer.exception.DuplicateEmailException;
import camp.woowak.lab.customer.exception.InvalidCreationException;
Expand Down Expand Up @@ -43,10 +44,11 @@ void testRollbackOnDuplicateEmail() throws InvalidCreationException, DuplicateEm
// then
try {
service.signUp(command2);
fail("중복 이메일 예외가 발생해야 합니다.");
} catch (DuplicateEmailException e) {
assertEquals(1, customerRepository.count());
assertEquals(1, payAccountRepository.count());
} catch (DataIntegrityViolationException e) {
fail("DataIntegrityViolationException이 발생했습니다.");
}
}
}
}

0 comments on commit e280c79

Please sign in to comment.