diff --git a/backend/src/main/java/com/festago/festival/repository/FestivalDetailV1QueryDslRepository.java b/backend/src/main/java/com/festago/festival/repository/FestivalDetailV1QueryDslRepository.java index ddb1eb2ae..73380c8ec 100644 --- a/backend/src/main/java/com/festago/festival/repository/FestivalDetailV1QueryDslRepository.java +++ b/backend/src/main/java/com/festago/festival/repository/FestivalDetailV1QueryDslRepository.java @@ -64,7 +64,7 @@ public Optional findFestivalDetail(Long festivalId) { stage.id, stage.startTime, stageQueryInfo.artistInfo - ).skipNulls(), Comparator.comparingLong(StageV1Response::id)) + ).skipNulls(), Comparator.comparing(StageV1Response::startDateTime)) ) ) ); diff --git a/backend/src/test/java/com/festago/festival/application/integration/query/FestivalDetailV1QueryServiceIntegrationTest.java b/backend/src/test/java/com/festago/festival/application/integration/query/FestivalDetailV1QueryServiceIntegrationTest.java index bdd1e587e..c6e41e11f 100644 --- a/backend/src/test/java/com/festago/festival/application/integration/query/FestivalDetailV1QueryServiceIntegrationTest.java +++ b/backend/src/test/java/com/festago/festival/application/integration/query/FestivalDetailV1QueryServiceIntegrationTest.java @@ -1,5 +1,6 @@ package com.festago.festival.application.integration.query; +import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.SoftAssertions.assertSoftly; @@ -10,6 +11,7 @@ import com.festago.festival.application.FestivalDetailV1QueryService; import com.festago.festival.application.command.FestivalCreateService; import com.festago.festival.dto.SocialMediaV1Response; +import com.festago.festival.dto.StageV1Response; import com.festago.festival.dto.command.FestivalCreateCommand; import com.festago.school.application.SchoolCommandService; import com.festago.school.domain.SchoolRegion; @@ -83,10 +85,10 @@ void setUp() { LocalDateTime ticketOpenTime = now.minusWeeks(1).atStartOfDay(); stageCreateService.createStage(new StageCreateCommand( - 테코대학교_축제_식별자, now.atTime(18, 0), ticketOpenTime, List.of(아티스트_식별자) + 테코대학교_축제_식별자, now.plusDays(1).atTime(18, 0), ticketOpenTime, List.of(아티스트_식별자) )); stageCreateService.createStage(new StageCreateCommand( - 테코대학교_축제_식별자, now.plusDays(1).atTime(18, 0), ticketOpenTime, List.of(아티스트_식별자) + 테코대학교_축제_식별자, now.atTime(18, 0), ticketOpenTime, List.of(아티스트_식별자) )); stageCreateService.createStage(new StageCreateCommand( 테코대학교_축제_식별자, now.plusDays(2).atTime(18, 0), ticketOpenTime, List.of(아티스트_식별자) @@ -145,6 +147,18 @@ private Long createSchool(String schoolName, String domain) { }); } + @Test + void 공연_목록은_공연의_시작_시간_기준으로_정렬된다() { + // when + var response = festivalDetailV1QueryService.findFestivalDetail(테코대학교_축제_식별자); + + // then + assertThat(response.stages()) + .map(StageV1Response::startDateTime) + .map(LocalDateTime::toLocalDate) + .containsExactly(now, now.plusDays(1), now.plusDays(2)); + } + @Test void 축제에_공연이_없으면_응답의_공연에는_비어있는_컬렉션이_반환된다() { // when