From 6a0feab2949b83b20263b9a2411904ddd9ef9553 Mon Sep 17 00:00:00 2001 From: 70825 Date: Tue, 23 Apr 2024 15:46:52 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=98=A4=EB=8A=98=EC=9D=98=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EA=B0=9C=EC=88=98=EB=A5=BC=203=EA=B0=9C?= =?UTF-8?q?=EC=97=90=EC=84=9C=202=EA=B0=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../review/application/ReviewService.java | 2 +- .../review/ReviewAcceptanceTest.java | 2 +- .../review/application/ReviewServiceTest.java | 20 ++++++++----------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/funeat/review/application/ReviewService.java b/src/main/java/com/funeat/review/application/ReviewService.java index 79399853..f9f12b97 100644 --- a/src/main/java/com/funeat/review/application/ReviewService.java +++ b/src/main/java/com/funeat/review/application/ReviewService.java @@ -60,7 +60,7 @@ public class ReviewService { private static final int START_INDEX = 0; private static final int ONE = 1; private static final String EMPTY_URL = ""; - private static final int RANKING_SIZE = 3; + private static final int RANKING_SIZE = 2; private static final long RANKING_MINIMUM_FAVORITE_COUNT = 1L; private static final int REVIEW_PAGE_SIZE = 10; diff --git a/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java b/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java index 24d1e6ee..c3a9ab61 100644 --- a/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java +++ b/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java @@ -737,7 +737,7 @@ class getRankingReviews_성공_테스트 { // then STATUS_CODE를_검증한다(응답, 정상_처리); - 리뷰_랭킹_조회_결과를_검증한다(응답, List.of(리뷰2, 리뷰3, 리뷰4)); + 리뷰_랭킹_조회_결과를_검증한다(응답, List.of(리뷰2, 리뷰3)); } } diff --git a/src/test/java/com/funeat/review/application/ReviewServiceTest.java b/src/test/java/com/funeat/review/application/ReviewServiceTest.java index 45a20ac2..0c6a3880 100644 --- a/src/test/java/com/funeat/review/application/ReviewServiceTest.java +++ b/src/test/java/com/funeat/review/application/ReviewServiceTest.java @@ -1217,7 +1217,7 @@ class 리뷰_개수에_대한_테스트 { } @Test - void 전체_리뷰가_1개_이상_3개_미만이라도_리뷰가_나와야한다() { + void 전체_리뷰가_1개라도_리뷰가_나와야한다() { // given final var category = 카테고리_간편식사_생성(); 단일_카테고리_저장(category); @@ -1229,13 +1229,11 @@ class 리뷰_개수에_대한_테스트 { 단일_멤버_저장(member); final var now = LocalDateTime.now(); - final var review1 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 2L, now.minusDays(1L)); - final var review2 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 2L, now); - 복수_리뷰_저장(review1, review2); + final var review = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 2L, now.minusDays(1L)); + 단일_리뷰_저장(review); - final var rankingReviewDto1 = RankingReviewDto.toDto(review1); - final var rankingReviewDto2 = RankingReviewDto.toDto(review2); - final var rankingReviewDtos = List.of(rankingReviewDto2, rankingReviewDto1); + final var rankingReviewDto = RankingReviewDto.toDto(review); + final var rankingReviewDtos = List.of(rankingReviewDto); final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos); // when @@ -1247,7 +1245,7 @@ class 리뷰_개수에_대한_테스트 { } @Test - void 전체_리뷰_중_랭킹이_높은_상위_3개_리뷰를_구할_수_있다() { + void 전체_리뷰_중_랭킹이_높은_상위_2개_리뷰를_구할_수_있다() { // given final var category = 카테고리_간편식사_생성(); 단일_카테고리_저장(category); @@ -1262,14 +1260,12 @@ class 리뷰_개수에_대한_테스트 { final var review1 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 4L, now.minusDays(3L)); final var review2 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 6L, now.minusDays(2L)); final var review3 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 4L, now); - final var review4 = 리뷰_이미지test5_평점5점_재구매X_생성(member, product, 5L, now); - 복수_리뷰_저장(review1, review2, review3, review4); + 복수_리뷰_저장(review1, review2, review3); final var rankingReviewDto1 = RankingReviewDto.toDto(review1); final var rankingReviewDto2 = RankingReviewDto.toDto(review2); final var rankingReviewDto3 = RankingReviewDto.toDto(review3); - final var rankingReviewDto4 = RankingReviewDto.toDto(review4); - final var rankingReviewDtos = List.of(rankingReviewDto4, rankingReviewDto3, rankingReviewDto2); + final var rankingReviewDtos = List.of(rankingReviewDto3, rankingReviewDto2); final var expected = RankingReviewsResponse.toResponse(rankingReviewDtos); // when