From e280c79910f806831665bf75c301ec1adf07a744 Mon Sep 17 00:00:00 2001 From: kimhyun5u <22kimhyun5u@gmail.com> Date: Wed, 14 Aug 2024 21:55:21 +0900 Subject: [PATCH] =?UTF-8?q?[test]=20SignUpCustomerServiceIntegrationTest?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20-=20DataIntegrityViolationException=20?= =?UTF-8?q?=EB=A5=BC=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=EC=97=90=EC=84=9C=20=EC=9E=A1=EC=A7=80=20=EB=AA=BB?= =?UTF-8?q?=ED=95=98=EB=A9=B4=20=EC=97=90=EB=9F=AC=20=EB=AA=85=EC=8B=9C?= =?UTF-8?q?=EB=90=9C=20=EC=B6=9C=EB=9F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SignUpCustomerServiceIntegrationTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/java/camp/woowak/lab/customer/service/SignUpCustomerServiceIntegrationTest.java b/src/test/java/camp/woowak/lab/customer/service/SignUpCustomerServiceIntegrationTest.java index afb237b4..3a8ea264 100644 --- a/src/test/java/camp/woowak/lab/customer/service/SignUpCustomerServiceIntegrationTest.java +++ b/src/test/java/camp/woowak/lab/customer/service/SignUpCustomerServiceIntegrationTest.java @@ -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; @@ -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이 발생했습니다."); } } -} \ No newline at end of file +}