From 4ea704682d683a8f946bdf69b8e1fa58405ab422 Mon Sep 17 00:00:00 2001 From: devholic22 Date: Sat, 13 Jul 2024 17:54:12 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20AuditingHandler=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EC=9D=B4=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AlertQueryRepositoryTest에 AuditingHandler 추가 --- .../alert/infrastructure/AlertQueryRepositoryTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/com/atwoz/alert/infrastructure/AlertQueryRepositoryTest.java b/src/test/java/com/atwoz/alert/infrastructure/AlertQueryRepositoryTest.java index 8bf2ce5a..40722417 100644 --- a/src/test/java/com/atwoz/alert/infrastructure/AlertQueryRepositoryTest.java +++ b/src/test/java/com/atwoz/alert/infrastructure/AlertQueryRepositoryTest.java @@ -10,9 +10,11 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.auditing.AuditingHandler; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -29,6 +31,9 @@ class AlertQueryRepositoryTest extends IntegrationHelper { @Autowired private AlertQueryRepository alertQueryRepository; + @Autowired + private AuditingHandler auditingHandler; + @Autowired private AlertRepository alertRepository; @@ -43,6 +48,8 @@ class 알림_조회_정상 { for (int day = 1; day <= 10; day++) { Alert alert = 알림_생성_제목_날짜_주입("알림 제목 " + day, day); + LocalDateTime futureTime = LocalDateTime.now().plusDays(day); + auditingHandler.setDateTimeProvider(() -> Optional.of(futureTime)); alertRepository.save(alert); alerts.add(alert); }