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 af1631c77..2c087b700 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.domain.Festival; import com.festago.festival.dto.SocialMediaV1Response; +import com.festago.festival.dto.StageV1Response; import com.festago.festival.repository.FestivalRepository; import com.festago.school.domain.School; import com.festago.school.repository.SchoolRepository; @@ -28,6 +30,7 @@ import com.festago.support.fixture.StageArtistFixture; import com.festago.support.fixture.StageFixture; import java.time.LocalDate; +import java.time.LocalDateTime; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator; @@ -174,6 +177,18 @@ private School createSchool(String schoolName, String domain) { }); } + @Test + void 공연_목록은_공연의_시작_시간_기준으로_정렬된다() { + // when + var response = festivalDetailV1QueryService.findFestivalDetail(테코대학교_축제.getId()); + + // then + assertThat(response.stages()) + .map(StageV1Response::startDateTime) + .map(LocalDateTime::toLocalDate) + .containsExactly(now, now.plusDays(1), now.plusDays(2)); + } + @Test void 축제에_공연이_없으면_응답의_공연에는_비어있는_컬렉션이_반환된다() { // when