Skip to content

Commit

Permalink
test: 사용하지 않는 Tag 생성자 삭제 및 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Go-Jaecheol committed Jul 27, 2023
1 parent a9e91b8 commit aca7d8a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 0 additions & 4 deletions backend/src/main/java/com/funeat/tag/domain/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -318,7 +319,6 @@ class 리뷰수_기준_내림차순으로_카테고리별_상품_목록_조회 {
review3_1, review3_2, review3_3);
복수_리뷰_가_요청(reviews);


// when
final var response = 카테고리별_상품_목록_조회_요청(categoryId, "reviewCount", "desc", 0);

Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,8 +107,8 @@ class ReviewAcceptanceTest extends AcceptanceTest {
}

private List<Long> 태그_가_요청() {
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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -166,8 +167,8 @@ void init() {
}

private List<Tag> 태그_가_요청() {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit aca7d8a

Please sign in to comment.