From 6981d5cd165f35dda6a4a1426fcdb5591231cf93 Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 16:44:04 +0900 Subject: [PATCH 1/8] =?UTF-8?q?#332=20[feat]=20=EC=9A=94=EA=B5=AC=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EC=9D=98=ED=95=9C=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EB=B6=84=EA=B8=B0=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 각 쿼리마다 조건문을 분기처리 하는 것은 비효율적이라고 생각했습니다. 그래서 querydsl의 BooleanExpression을 활용하는 방식으로 구현했습니다. Querydsl의 DateTimePath을 아규먼트로 받아서 분기 처리 로직을 구현했습니다. 만약 null이 들어오면 조건식이 저절로 추가되지 않습니다. --- .../internal/MetricsRepository.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/asap/server/persistence/repository/internal/MetricsRepository.java b/src/main/java/com/asap/server/persistence/repository/internal/MetricsRepository.java index 7ad2e8d..02e3fee 100644 --- a/src/main/java/com/asap/server/persistence/repository/internal/MetricsRepository.java +++ b/src/main/java/com/asap/server/persistence/repository/internal/MetricsRepository.java @@ -3,6 +3,8 @@ import static com.asap.server.persistence.domain.QMeeting.meeting; import static com.asap.server.persistence.domain.user.QUser.user; +import com.querydsl.core.types.dsl.BooleanExpression; +import com.querydsl.core.types.dsl.DateTimePath; import com.querydsl.jpa.impl.JPAQueryFactory; import java.time.LocalDateTime; import lombok.RequiredArgsConstructor; @@ -17,7 +19,7 @@ public Long countTotalMeetingCount(final LocalDateTime from, final LocalDateTime return jpaQueryFactory .select(meeting.count()) .from(meeting) - .where(meeting.createdAt.between(from, to)) + .where(generateDateFilter(meeting.createdAt, from, to)) .fetchOne(); } @@ -27,7 +29,7 @@ public Long countTotalConfirmedMeetingCount(final LocalDateTime from, final Loca .from(meeting) .where( meeting.confirmedDateTime.confirmedStartTime.isNotNull() - .and(meeting.createdAt.between(from, to)) + .and(generateDateFilter(meeting.createdAt, from, to)) ) .fetchOne(); } @@ -36,7 +38,24 @@ public Long countTotalUserCount(final LocalDateTime from, final LocalDateTime to return jpaQueryFactory .select(user.count()) .from(user) - .where(user.createdAt.between(from, to)) + .where(generateDateFilter(user.createdAt, from, to)) .fetchOne(); } + + private BooleanExpression generateDateFilter( + final DateTimePath createdAt, + final LocalDateTime from, + final LocalDateTime to + ) { + if (from != null && to != null) { + return createdAt.between(from, to); + } + if (from != null) { + return createdAt.after(from); + } + if (to != null) { + return createdAt.before(to); + } + return null; + } } From efe88bd3a3e302894870388b91b716af2decfa13 Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 16:46:31 +0900 Subject: [PATCH 2/8] =?UTF-8?q?#322=20[test]=20generate=20filter=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=20=EC=B2=98=EB=A6=AC=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit created at이 들어있는 AuditingTimeEntity 가 abstract 클래스이기 때문에 entity manager를 사용하여 save 할 수 없었습니다. 그래서 sql을 이용해서 더미 값을 넣어줬습니다. 테스트 주요 대상은 createdAt 칼럼이기 때문에 나머지 값은 템플릿 화하고, createdAt 만 beforeEach에서 별도로 넣어줬습니다. --- ...tricsRepositoryGenerateDateFilterTest.java | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java diff --git a/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java b/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java new file mode 100644 index 0000000..3633b00 --- /dev/null +++ b/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java @@ -0,0 +1,112 @@ +package com.asap.server.persistence.repository.internal; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +import com.asap.server.persistence.config.querydsl.QueryDslConfig; +import jakarta.persistence.EntityManager; +import java.time.LocalDateTime; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +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.context.annotation.Import; +import org.springframework.transaction.annotation.Transactional; + +@Transactional +@DataJpaTest +@Import({QueryDslConfig.class, MetricsRepository.class}) +@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) +class MetricsRepositoryGenerateDateFilterTest { + private static final String INSERT_QUERY_TEMPLATE = "INSERT INTO meeting (title, password, duration, place_type, additional_info, created_at) VALUES ('title', '1234', 'HALF','ONLINE', '', ?)"; + + @Autowired + private MetricsRepository metricsRepository; + + @Autowired + private EntityManager em; + + @DisplayName( + """ + 1. 2022년 5월 20일 데이터 + 2. 2023년 1월 1일 데이터 + 3. 2023년 6월 15일 데이터 + 4. 2023년 12월 31일 데이터 + """ + ) + @BeforeEach + public void setUp() { + em.createNativeQuery(INSERT_QUERY_TEMPLATE) + .setParameter(1, "2022-05-20T10:00:00") + .executeUpdate(); + + em.createNativeQuery(INSERT_QUERY_TEMPLATE) + .setParameter(1, "2023-01-01T12:00:00") + .executeUpdate(); + + em.createNativeQuery(INSERT_QUERY_TEMPLATE) + .setParameter(1, "2023-06-15T15:30:00") + .executeUpdate(); + + em.createNativeQuery(INSERT_QUERY_TEMPLATE) + .setParameter(1, "2023-12-31T23:59:59") + .executeUpdate(); + } + + @DisplayName("시작 날짜와 종료 날짜 모두가 주어졌을 때, 주어진 범위 내의 결과를 반환한다.") + @Test + public void test() { + // given + LocalDateTime from = LocalDateTime.of(2023, 1, 1, 0, 0); + LocalDateTime to = LocalDateTime.of(2023, 12, 31, 0, 0); + + // when + Long count = metricsRepository.countTotalMeetingCount(from, to); + + // then + assertThat(count).isEqualTo(2); + } + + @DisplayName("시작 날짜가 주어지고 종료 날짜가 주어지지 않았을 때, 시작 날짜 이후의 결과를 반환한다.") + @Test + public void test2() { + // given + LocalDateTime from = LocalDateTime.of(2023, 6, 1, 0, 0); + LocalDateTime to = null; + + // when + Long count = metricsRepository.countTotalMeetingCount(from, to); + + // then + assertThat(count).isEqualTo(2); + } + + @DisplayName("종료 날짜가 주어지고 시작 날짜가 주어지지 않았을 때, 종료 날짜 이전의 결과를 반환한다.") + @Test + public void test3() { + // given + LocalDateTime from = null; + LocalDateTime to = LocalDateTime.of(2023, 1, 1, 0, 0); + + // when + Long count = metricsRepository.countTotalMeetingCount(from, to); + + // then + assertThat(count).isEqualTo(1); + } + + @DisplayName("날짜 범위가 주어지지 않았을 때, 전범위를 반환한다.") + @Test + public void test4() { + // given + LocalDateTime from = null; + LocalDateTime to = null; + + // when + Long count = metricsRepository.countTotalMeetingCount(from, to); + + // then + assertThat(count).isEqualTo(4); + } +} From d912254b4b2fad1fdfa59d5565fb9e9165db687e Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 16:50:25 +0900 Subject: [PATCH 3/8] =?UTF-8?q?#332=20[feat]=20=EC=9A=94=EA=B5=AC=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?service=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit from과 to로 null 값이 들어올 수 있기 때문에 서비스 로직을 일부 수정했습니다. --- .../server/service/internal/MetricsService.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/asap/server/service/internal/MetricsService.java b/src/main/java/com/asap/server/service/internal/MetricsService.java index 5a97336..98b1c0a 100644 --- a/src/main/java/com/asap/server/service/internal/MetricsService.java +++ b/src/main/java/com/asap/server/service/internal/MetricsService.java @@ -5,7 +5,6 @@ import com.asap.server.common.exception.model.BadRequestException; import com.asap.server.infra.slack.MetricsEvent; import com.asap.server.persistence.repository.internal.MetricsRepository; -import java.io.IOException; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -27,8 +26,14 @@ public void sendMetrics(final String fromStr, final String toStr) { throw new BadRequestException(INVALID_DATE_FORMAT_EXCEPTION); } - LocalDateTime from = LocalDate.parse(fromStr, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay(); - LocalDateTime to = LocalDate.parse(toStr, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay(); + LocalDateTime from = null; + LocalDateTime to = null; + if (fromStr != null) { + from = LocalDate.parse(fromStr, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay(); + } + if (toStr != null) { + to = LocalDate.parse(toStr, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay(); + } Map metrics = new HashMap<>(); metrics.put("개설된 총 회의 수", String.valueOf(metricsRepository.countTotalMeetingCount(from, to))); @@ -39,6 +44,10 @@ public void sendMetrics(final String fromStr, final String toStr) { } private boolean isValidDate(final String dateStr) { + if (dateStr == null) { + return true; + } + try { LocalDate.parse(dateStr, DateTimeFormatter.ISO_LOCAL_DATE); return true; From ef6f385903898074710ee876900a969621034828 Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 16:50:57 +0900 Subject: [PATCH 4/8] =?UTF-8?q?#332=20[test]=20=EB=A9=94=ED=8A=B8=EB=A6=AD?= =?UTF-8?q?=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=A1=9C=EC=A7=81=20=EA=B2=80=EC=A6=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 비즈니스 로직 변경에 따라서 테스트 코드도 수정하여 로직을 검증했습니다. --- .../service/internal/MetricsServiceTest.java | 74 ++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/asap/server/service/internal/MetricsServiceTest.java b/src/test/java/com/asap/server/service/internal/MetricsServiceTest.java index 5255cc2..06dae09 100644 --- a/src/test/java/com/asap/server/service/internal/MetricsServiceTest.java +++ b/src/test/java/com/asap/server/service/internal/MetricsServiceTest.java @@ -9,7 +9,6 @@ import com.asap.server.common.exception.model.BadRequestException; import com.asap.server.infra.slack.MetricsEvent; import com.asap.server.persistence.repository.internal.MetricsRepository; -import java.io.IOException; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -71,4 +70,77 @@ void test2(String fromStr) { .isInstanceOf(BadRequestException.class) .hasMessage("유효하지 않은 날짜를 입력했습니다."); } + + @DisplayName("시작, 종료 날짜 모두 들어오지 않을 수 있다.") + @Test + void test3() { + // given + String fromStr = null; + String toStr = null; + + when(metricsRepository.countTotalMeetingCount(null, null)).thenReturn(1L); + when(metricsRepository.countTotalUserCount(null, null)).thenReturn(1L); + when(metricsRepository.countTotalConfirmedMeetingCount(null, null)).thenReturn(1L); + Map metrics = Map.of( + "개설된 총 회의 수", "1", + "사용한 총 사용자 수", "1", + "확정된 총 회의 수", "1" + ); + + // when + metricsService.sendMetrics(fromStr, toStr); + + // then + verify(publisher, times(1)).publishEvent(new MetricsEvent(metrics)); + } + + @DisplayName("시작 날짜는 들어오지 않고, 종료 날짜만 들어올 수 있다.") + @Test + void test4() { + // given + String fromStr = null; + String toStr = "2024-08-26"; + + LocalDateTime to = LocalDate.parse(toStr, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay(); + + when(metricsRepository.countTotalMeetingCount(null, to)).thenReturn(1L); + when(metricsRepository.countTotalUserCount(null, to)).thenReturn(1L); + when(metricsRepository.countTotalConfirmedMeetingCount(null, to)).thenReturn(1L); + Map metrics = Map.of( + "개설된 총 회의 수", "1", + "사용한 총 사용자 수", "1", + "확정된 총 회의 수", "1" + ); + + // when + metricsService.sendMetrics(fromStr, toStr); + + // then + verify(publisher, times(1)).publishEvent(new MetricsEvent(metrics)); + } + + @DisplayName("시작 날짜는 들어오고, 종료 날짜는 들어오지 않을 수 있다.") + @Test + void test5() { + // given + String fromStr = "2024-08-26"; + String toStr = null; + + LocalDateTime from = LocalDate.parse(fromStr, DateTimeFormatter.ISO_LOCAL_DATE).atStartOfDay(); + + when(metricsRepository.countTotalMeetingCount(from, null)).thenReturn(1L); + when(metricsRepository.countTotalUserCount(from, null)).thenReturn(1L); + when(metricsRepository.countTotalConfirmedMeetingCount(from, null)).thenReturn(1L); + Map metrics = Map.of( + "개설된 총 회의 수", "1", + "사용한 총 사용자 수", "1", + "확정된 총 회의 수", "1" + ); + + // when + metricsService.sendMetrics(fromStr, toStr); + + // then + verify(publisher, times(1)).publishEvent(new MetricsEvent(metrics)); + } } \ No newline at end of file From 0550131a227ef421c3f3cc45a937324dfd7ee141 Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 16:51:44 +0900 Subject: [PATCH 5/8] =?UTF-8?q?#332=20[feat]=20=EC=BF=BC=EB=A6=AC=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=EB=A1=9C=20null=20?= =?UTF-8?q?=EA=B0=92=EC=9D=B4=20=EB=93=A4=EC=96=B4=EC=98=AC=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=EA=B8=B0=EB=8A=A5=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 from과 to에 null이 들어올 수 있기 때문에 이를 반영했습니다. --- .../presentation/controller/internal/MetricsController.java | 6 +++--- .../controller/internal/docs/MetricsControllerDocs.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/asap/server/presentation/controller/internal/MetricsController.java b/src/main/java/com/asap/server/presentation/controller/internal/MetricsController.java index 4a63bad..bd13f39 100644 --- a/src/main/java/com/asap/server/presentation/controller/internal/MetricsController.java +++ b/src/main/java/com/asap/server/presentation/controller/internal/MetricsController.java @@ -18,10 +18,10 @@ public class MetricsController implements MetricsControllerDocs { @GetMapping("/metrics") public SuccessResponse sendMetrics( - @RequestParam("from") final String from, - @RequestParam("to") final String to + @RequestParam(value = "from", required = false) final String from, + @RequestParam(value = "to", required = false) final String to ) { - metricsService.sendMetrics(from.trim(), to.trim()); + metricsService.sendMetrics(from, to); return SuccessResponse.success(Success.GET_METRICS_SUCCESS); } } diff --git a/src/main/java/com/asap/server/presentation/controller/internal/docs/MetricsControllerDocs.java b/src/main/java/com/asap/server/presentation/controller/internal/docs/MetricsControllerDocs.java index f3e13a6..562a94e 100644 --- a/src/main/java/com/asap/server/presentation/controller/internal/docs/MetricsControllerDocs.java +++ b/src/main/java/com/asap/server/presentation/controller/internal/docs/MetricsControllerDocs.java @@ -23,7 +23,7 @@ public interface MetricsControllerDocs { @ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) }) SuccessResponse sendMetrics( - @Parameter(example = "2024-08-12", required = true) final String from, - @Parameter(example = "2024-08-15", required = true) final String to + @Parameter(example = "2024-08-12") final String from, + @Parameter(example = "2024-08-15") final String to ); } From 3bc11d86ac426641ec4c335a43b7756649aa6bd9 Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 17:16:52 +0900 Subject: [PATCH 6/8] =?UTF-8?q?#332=20[test]=20spring=20boot=20test?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MetricsRepositoryGenerateDateFilterTest.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java b/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java index 3633b00..5d94588 100644 --- a/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java +++ b/src/test/java/com/asap/server/persistence/repository/internal/MetricsRepositoryGenerateDateFilterTest.java @@ -2,22 +2,17 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import com.asap.server.persistence.config.querydsl.QueryDslConfig; import jakarta.persistence.EntityManager; import java.time.LocalDateTime; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; 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.context.annotation.Import; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; @Transactional -@DataJpaTest -@Import({QueryDslConfig.class, MetricsRepository.class}) -@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) +@SpringBootTest class MetricsRepositoryGenerateDateFilterTest { private static final String INSERT_QUERY_TEMPLATE = "INSERT INTO meeting (title, password, duration, place_type, additional_info, created_at) VALUES ('title', '1234', 'HALF','ONLINE', '', ?)"; From 3228a86f66b00d626d1af219834fb773e019ec57 Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 17:24:32 +0900 Subject: [PATCH 7/8] =?UTF-8?q?#332=20[feat]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=8B=A4=ED=8C=A8=20=EC=9B=90=EC=9D=B8=EC=9D=84=20=ED=8C=8C?= =?UTF-8?q?=EC=95=85=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index d153d24..7d27ba2 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,12 @@ bootJar { enabled = true; } +tasks.test { + testLogging { + exceptionFormat = 'full' + } +} + configurations { compileOnly { extendsFrom annotationProcessor From 7e2bc4643415e09b32a19432f973c3254018c7ff Mon Sep 17 00:00:00 2001 From: KWY Date: Sun, 1 Sep 2024 17:30:24 +0900 Subject: [PATCH 8/8] =?UTF-8?q?#332=20[test]=20=EC=9D=B8=EC=88=98=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=97=90=20transactional=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 테스트 이후 값이 초기화가 되지 않아서 다른 테스트가 실패했습니다. 따라서 테스트 이후 값을 초기화하기 위해서 인수 테스트에 transactional을 추가했습니다. --- .../com/asap/server/concurrency/DuplicatedInterceptorTest.java | 2 ++ .../presentation/controller/MeetingRetrieveControllerTest.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/test/java/com/asap/server/concurrency/DuplicatedInterceptorTest.java b/src/test/java/com/asap/server/concurrency/DuplicatedInterceptorTest.java index 9575eef..b183f33 100644 --- a/src/test/java/com/asap/server/concurrency/DuplicatedInterceptorTest.java +++ b/src/test/java/com/asap/server/concurrency/DuplicatedInterceptorTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.springframework.transaction.annotation.Transactional; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -27,6 +28,7 @@ @SpringBootTest @AutoConfigureMockMvc +@Transactional public class DuplicatedInterceptorTest { @Autowired private MockMvc mockMvc; diff --git a/src/test/java/com/asap/server/presentation/controller/MeetingRetrieveControllerTest.java b/src/test/java/com/asap/server/presentation/controller/MeetingRetrieveControllerTest.java index 7773d44..bbb6f58 100644 --- a/src/test/java/com/asap/server/presentation/controller/MeetingRetrieveControllerTest.java +++ b/src/test/java/com/asap/server/presentation/controller/MeetingRetrieveControllerTest.java @@ -16,7 +16,9 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import java.nio.charset.Charset; +import org.springframework.transaction.annotation.Transactional; +@Transactional @ExtendWith(MockitoExtension.class) public class MeetingRetrieveControllerTest {