Skip to content

Commit

Permalink
refactor: 이미지 형식 관련 예외는 imageService에서 발생하여 테스트 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Sehee-Lee-01 committed Jan 16, 2024
1 parent c3e4f58 commit b6a525b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,12 @@ void updateFailWithInvalidPostUpdateRequest(String testCase, PostUpdateRequest r
@MethodSource("provideInvalidFile")
@DisplayName("수정할 이미지를 보냈는데 이미지 파일이 유효하지 않으면 수정에 실패한다.")
void updateFailWithInvalidFileType(String originalFileName, String mediaType) {
// given // when
// given
PostUpdateRequest request = new PostUpdateRequest(TITLE, CONTENT);
MockMultipartFile postImg = getPostImg(originalFileName, mediaType);
given(imageService.upload(postImg)).willThrow(IllegalArgumentException.class);

// when
ThrowingCallable updatePost = () -> postService.update(userPost.getId(), postImg, request);

//then
Expand Down Expand Up @@ -487,7 +489,7 @@ void updateFailWithInvalidFileType(String originalFileName, String mediaType) {

PostSaveRequest postSaveRequest = new PostSaveRequest(TITLE, CONTENT, VALID_COORDINATE);
MockMultipartFile postImg = getPostImg(originalFileName, mediaType);
given(imageService.upload(postImg)).willReturn(new ImageFile(IMG_URL, ORIGINAL_FILE_NAME));
given(imageService.upload(postImg)).willThrow(IllegalArgumentException.class);

// when, then
assertThrows(IllegalArgumentException.class,
Expand Down

0 comments on commit b6a525b

Please sign in to comment.