Skip to content

Commit e3beb57

Browse files
committed
refactor: QueryUseCase에서 이미 작성된 테스트 삭제
1 parent c04d2a0 commit e3beb57

File tree

2 files changed

+7
-64
lines changed

2 files changed

+7
-64
lines changed

src/test/java/com/somemore/domains/review/service/DeleteReviewServiceTest.java

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
package com.somemore.domains.review.service;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import com.somemore.domains.review.domain.Review;
46
import com.somemore.domains.review.repository.ReviewRepository;
5-
import com.somemore.global.exception.NoSuchElementException;
67
import com.somemore.support.IntegrationTestSupport;
8+
import java.util.Optional;
9+
import java.util.UUID;
710
import org.junit.jupiter.api.DisplayName;
811
import org.junit.jupiter.api.Test;
912
import org.springframework.beans.factory.annotation.Autowired;
1013
import org.springframework.transaction.annotation.Transactional;
1114

12-
import java.util.Optional;
13-
import java.util.UUID;
14-
15-
import static com.somemore.global.exception.ExceptionMessage.NOT_EXISTS_REVIEW;
16-
import static org.assertj.core.api.Assertions.assertThat;
17-
import static org.assertj.core.api.Assertions.assertThatThrownBy;
18-
1915
@Transactional
2016
class DeleteReviewServiceTest extends IntegrationTestSupport {
2117

@@ -45,21 +41,6 @@ void deleteReview() {
4541
assertThat(findReview).isEmpty();
4642
}
4743

48-
@DisplayName("존재하지 않는 리뷰를 삭제하려고 하는 경우 에러가 발생한다")
49-
@Test
50-
void deleteReviewWhenDoesNotExist() {
51-
// given
52-
UUID volunteerId = UUID.randomUUID();
53-
Long wrongId = 999L;
54-
55-
// when
56-
// then
57-
assertThatThrownBy(
58-
() -> deleteReviewService.deleteReview(volunteerId, wrongId))
59-
.isInstanceOf(NoSuchElementException.class)
60-
.hasMessage(NOT_EXISTS_REVIEW.getMessage());
61-
}
62-
6344
private Review createReview(UUID volunteerId, String title, String content, String imgUrl) {
6445
return Review.builder()
6546
.volunteerApplyId(1L)

src/test/java/com/somemore/domains/review/service/UpdateReviewServiceTest.java

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
package com.somemore.domains.review.service;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import com.somemore.domains.review.domain.Review;
46
import com.somemore.domains.review.dto.request.ReviewUpdateRequestDto;
57
import com.somemore.domains.review.repository.ReviewRepository;
6-
import com.somemore.global.exception.NoSuchElementException;
78
import com.somemore.support.IntegrationTestSupport;
9+
import java.util.UUID;
810
import org.junit.jupiter.api.BeforeEach;
911
import org.junit.jupiter.api.DisplayName;
1012
import org.junit.jupiter.api.Test;
1113
import org.springframework.beans.factory.annotation.Autowired;
1214
import org.springframework.transaction.annotation.Transactional;
1315

14-
import java.util.UUID;
15-
16-
import static com.somemore.global.exception.ExceptionMessage.NOT_EXISTS_REVIEW;
17-
import static org.assertj.core.api.Assertions.assertThat;
18-
import static org.assertj.core.api.Assertions.assertThatThrownBy;
19-
2016
@Transactional
2117
class UpdateReviewServiceTest extends IntegrationTestSupport {
2218

@@ -55,25 +51,6 @@ void updateReview() {
5551
assertThat(updateReview.getContent()).isEqualTo(dto.content());
5652
}
5753

58-
@DisplayName("존재하지 않는 리뷰를 업데이트할 경우 에러가 발생한다.")
59-
@Test
60-
void updateReviewWhenDoesNotExistId() {
61-
// given
62-
Long wrongId = 999L;
63-
64-
ReviewUpdateRequestDto dto = ReviewUpdateRequestDto.builder()
65-
.title("업데이트 제목")
66-
.content("업데이트 내용")
67-
.build();
68-
69-
// when
70-
// then
71-
assertThatThrownBy(
72-
() -> updateReviewService.updateReview(wrongId, volunteerId, dto))
73-
.isInstanceOf(NoSuchElementException.class)
74-
.hasMessage(NOT_EXISTS_REVIEW.getMessage());
75-
}
76-
7754
@DisplayName("리뷰 이미지 링크를 업데이트 할 수 있다.")
7855
@Test
7956
void updateReviewImageUrl() {
@@ -89,21 +66,6 @@ void updateReviewImageUrl() {
8966
assertThat(updateReview.getImgUrl()).isEqualTo(newImgUrl);
9067
}
9168

92-
@DisplayName("존재하지 않는 리뷰의 이미지링크를 업데이트할 경우 에러가 발생한다.")
93-
@Test
94-
void updateReviewImageUrlWhenDoesNotExistId() {
95-
// given
96-
Long wrongId = 999L;
97-
String newImgUrl = "newLink.co.kr";
98-
99-
// when
100-
// then
101-
assertThatThrownBy(
102-
() -> updateReviewService.updateReviewImageUrl(wrongId, volunteerId, newImgUrl))
103-
.isInstanceOf(NoSuchElementException.class)
104-
.hasMessage(NOT_EXISTS_REVIEW.getMessage());
105-
}
106-
10769
private Review createReview(Long applyId, UUID volunteerId) {
10870
return Review.builder()
10971
.volunteerApplyId(applyId)

0 commit comments

Comments
 (0)