From aca7d8a8619456d8047b66cbf8a6de9b953b9f58 Mon Sep 17 00:00:00 2001 From: Go-Jaecheol Date: Fri, 28 Jul 2023 02:05:39 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20Tag=20=EC=83=9D=EC=84=B1=EC=9E=90=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20=EB=B0=8F=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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/com/funeat/tag/domain/Tag.java | 4 ---- .../funeat/acceptance/product/ProductAcceptanceTest.java | 8 ++++---- .../funeat/acceptance/review/ReviewAcceptanceTest.java | 5 +++-- .../com/funeat/review/application/ReviewServiceTest.java | 5 +++-- .../review/persistence/ReviewTagRepositoryTest.java | 9 +++++---- .../com/funeat/tag/persistence/TagRepositoryTest.java | 5 +++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/backend/src/main/java/com/funeat/tag/domain/Tag.java b/backend/src/main/java/com/funeat/tag/domain/Tag.java index 8b4f8d995..554b8db6f 100644 --- a/backend/src/main/java/com/funeat/tag/domain/Tag.java +++ b/backend/src/main/java/com/funeat/tag/domain/Tag.java @@ -22,10 +22,6 @@ public class Tag { protected Tag() { } - public Tag(final String name) { - this.name = name; - } - public Tag(final String name, final TagType tagType) { this.name = name; this.tagType = tagType; diff --git a/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java index 7e3f9da33..3356a2426 100644 --- a/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/product/ProductAcceptanceTest.java @@ -24,6 +24,7 @@ import com.funeat.review.domain.Review; import com.funeat.review.presentation.dto.ReviewCreateRequest; import com.funeat.tag.domain.Tag; +import com.funeat.tag.domain.TagType; import io.restassured.common.mapper.TypeRef; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; @@ -318,7 +319,6 @@ class 리뷰수_기준_내림차순으로_카테고리별_상품_목록_조회 { review3_1, review3_2, review3_3); 복수_리뷰_추가_요청(reviews); - // when final var response = 카테고리별_상품_목록_조회_요청(categoryId, "reviewCount", "desc", 0); @@ -373,9 +373,9 @@ class 리뷰수_기준_내림차순으로_카테고리별_상품_목록_조회 { final Product product = new Product("삼각김밥1", 1000L, "image.png", "맛있는 삼각김밥1", 간편식사); final Long productId = 상품_추가_요청(product); final Long memberId = 기본_멤버_추가_요청(); - final Tag tag1 = 태그_추가_요청(new Tag("1번")); - final Tag tag2 = 태그_추가_요청(new Tag("2번")); - final Tag tag3 = 태그_추가_요청(new Tag("3번")); + final Tag tag1 = 태그_추가_요청(new Tag("1번", TagType.ETC)); + final Tag tag2 = 태그_추가_요청(new Tag("2번", TagType.ETC)); + final Tag tag3 = 태그_추가_요청(new Tag("3번", TagType.ETC)); final MultiPartSpecification image = 리뷰_사진_명세_요청(); final ReviewCreateRequest request1 = new ReviewCreateRequest(4L, diff --git a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java index acc2d2d68..33334a2bc 100644 --- a/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java +++ b/backend/src/test/java/com/funeat/acceptance/review/ReviewAcceptanceTest.java @@ -23,6 +23,7 @@ import com.funeat.review.presentation.dto.SortingReviewDto; import com.funeat.review.presentation.dto.SortingReviewsPageDto; import com.funeat.tag.domain.Tag; +import com.funeat.tag.domain.TagType; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; import io.restassured.specification.MultiPartSpecification; @@ -106,8 +107,8 @@ class ReviewAcceptanceTest extends AcceptanceTest { } private List 태그_추가_요청() { - final Tag testTag1 = tagRepository.save(new Tag("testTag1")); - final Tag testTag2 = tagRepository.save(new Tag("testTag2")); + final Tag testTag1 = tagRepository.save(new Tag("testTag1", TagType.ETC)); + final Tag testTag2 = tagRepository.save(new Tag("testTag2", TagType.ETC)); return List.of(testTag1.getId(), testTag2.getId()); } diff --git a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java index fc4f7177b..0957277bd 100644 --- a/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java +++ b/backend/src/test/java/com/funeat/review/application/ReviewServiceTest.java @@ -17,6 +17,7 @@ import com.funeat.review.presentation.dto.ReviewFavoriteRequest; import com.funeat.review.presentation.dto.SortingReviewDto; import com.funeat.tag.domain.Tag; +import com.funeat.tag.domain.TagType; import com.funeat.tag.persistence.TagRepository; import java.util.List; import java.util.stream.Collectors; @@ -166,8 +167,8 @@ void init() { } private List 태그_추가_요청() { - final Tag testTag1 = tagRepository.save(new Tag("testTag1")); - final Tag testTag2 = tagRepository.save(new Tag("testTag2")); + final Tag testTag1 = tagRepository.save(new Tag("testTag1", TagType.ETC)); + final Tag testTag2 = tagRepository.save(new Tag("testTag2", TagType.ETC)); return List.of(testTag1, testTag2); } diff --git a/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java b/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java index b65e52226..22cf8f5b1 100644 --- a/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java +++ b/backend/src/test/java/com/funeat/review/persistence/ReviewTagRepositoryTest.java @@ -11,6 +11,7 @@ import com.funeat.review.domain.Review; import com.funeat.review.domain.ReviewTag; import com.funeat.tag.domain.Tag; +import com.funeat.tag.domain.TagType; import com.funeat.tag.persistence.TagRepository; import java.util.List; import org.junit.jupiter.api.DisplayNameGeneration; @@ -53,10 +54,10 @@ class ReviewTagRepositoryTest { final var product = new Product("망고", 1_000L, "mango.png", "망고망고", null); productRepository.save(product); - final var tag1 = new Tag("1번"); - final var tag2 = new Tag("2번"); - final var tag3 = new Tag("3번"); - final var tag4 = new Tag("4번"); + final var tag1 = new Tag("1번", TagType.ETC); + final var tag2 = new Tag("2번", TagType.ETC); + final var tag3 = new Tag("3번", TagType.ETC); + final var tag4 = new Tag("4번", TagType.ETC); tagRepository.saveAll(List.of(tag1, tag2, tag3, tag4)); final var review1 = new Review(member, product, "review1.png", 5L, "최고의 망고", true, 25L); diff --git a/backend/src/test/java/com/funeat/tag/persistence/TagRepositoryTest.java b/backend/src/test/java/com/funeat/tag/persistence/TagRepositoryTest.java index 76f1305fe..1defe725a 100644 --- a/backend/src/test/java/com/funeat/tag/persistence/TagRepositoryTest.java +++ b/backend/src/test/java/com/funeat/tag/persistence/TagRepositoryTest.java @@ -1,5 +1,6 @@ package com.funeat.tag.persistence; +import static com.funeat.tag.domain.TagType.ETC; import static com.funeat.tag.domain.TagType.PRICE; import static com.funeat.tag.domain.TagType.TASTE; import static org.assertj.core.api.Assertions.assertThat; @@ -30,8 +31,8 @@ class TagRepositoryTest { @Test void 여러_태그_아이디로_태그들을_조회_할_수_있다() { // given - final var tag1 = 태그_추가_요청(new Tag("testTag1")); - final var tag2 = 태그_추가_요청(new Tag("testTag2")); + final var tag1 = 태그_추가_요청(new Tag("testTag1", ETC)); + final var tag2 = 태그_추가_요청(new Tag("testTag2", ETC)); final var tags = List.of(tag1, tag2); final var tagIds = tags.stream() .map(Tag::getId)