From 4fd36e927f24dea5d7d9a535eb7816e3c2ddb3e4 Mon Sep 17 00:00:00 2001 From: JunHyeongChoi Date: Wed, 6 Nov 2024 17:17:29 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=9A=A9=20?= =?UTF-8?q?db=20=EC=82=AC=EC=9A=A9=ED=95=98=EA=B2=8C=EB=81=94=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-prod.yml | 2 +- .../repository/DiaryRepositoryTest.java | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 4f5ff81..b03a870 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -12,7 +12,7 @@ spring: jdbc: time_zone: Asia/Seoul hibernate: - ddl-auto: update + ddl-auto: none h2: console: diff --git a/src/test/java/com/potatocake/everymoment/repository/DiaryRepositoryTest.java b/src/test/java/com/potatocake/everymoment/repository/DiaryRepositoryTest.java index bb2f2b8..8694a1e 100644 --- a/src/test/java/com/potatocake/everymoment/repository/DiaryRepositoryTest.java +++ b/src/test/java/com/potatocake/everymoment/repository/DiaryRepositoryTest.java @@ -12,15 +12,12 @@ import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.Point; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.jpa.domain.Specification; @DataJpaTest -@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) class DiaryRepositoryTest { @Autowired @@ -29,9 +26,6 @@ class DiaryRepositoryTest { @Autowired private MemberRepository memberRepository; - @Autowired - private TestEntityManager entityManager; - @Test @DisplayName("일기가 성공적으로 저장된다.") void should_SaveDiary_When_ValidEntity() { @@ -59,8 +53,6 @@ void should_FindDiaries_When_FilteringByMember() { Diary diary2 = createDiary(member, "Content 2", "Busan", "Address 2"); diaryRepository.saveAll(List.of(diary1, diary2)); - entityManager.flush(); - entityManager.clear(); // when Specification spec = (root, query, builder) -> @@ -104,8 +96,6 @@ void should_FindDiaries_When_FilteringWithSearchCriteria() { .build(); diaryRepository.saveAll(List.of(diary1, diary2)); - entityManager.flush(); - entityManager.clear(); // when Specification spec = DiarySpecification.filterDiaries( @@ -155,8 +145,6 @@ void should_FindDiaries_When_FilteringBookmarked() { .build(); diaryRepository.saveAll(List.of(diary1, diary2)); - entityManager.flush(); - entityManager.clear(); // when Specification spec = DiarySpecification.filterDiaries( @@ -197,5 +185,5 @@ private Diary createDiary(Member member, String content, String locationName, St .isPublic(false) .build(); } - + }