11package com .somemore .domains .review .service ;
22
3+ import static org .assertj .core .api .Assertions .assertThat ;
4+
35import com .somemore .domains .review .domain .Review ;
46import com .somemore .domains .review .dto .request .ReviewUpdateRequestDto ;
57import com .somemore .domains .review .repository .ReviewRepository ;
6- import com .somemore .global .exception .NoSuchElementException ;
78import com .somemore .support .IntegrationTestSupport ;
9+ import java .util .UUID ;
810import org .junit .jupiter .api .BeforeEach ;
911import org .junit .jupiter .api .DisplayName ;
1012import org .junit .jupiter .api .Test ;
1113import org .springframework .beans .factory .annotation .Autowired ;
1214import 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
2117class 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