Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] : 예외 코드 검증 추가
Browse files Browse the repository at this point in the history
hyun2371 committed Jan 10, 2025
1 parent fd7b8cd commit b2b50d2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@
import com.dnd.gongmuin.question_post.dto.response.QuestionPostDetailResponse;
import com.dnd.gongmuin.question_post.dto.response.RegisterQuestionPostResponse;
import com.dnd.gongmuin.question_post.dto.response.UpdateQuestionPostResponse;
import com.dnd.gongmuin.question_post.exception.QuestionPostErrorCode;
import com.dnd.gongmuin.question_post.repository.QuestionPostImageRepository;
import com.dnd.gongmuin.question_post.repository.QuestionPostRepository;

@@ -294,7 +295,10 @@ void deleteQuestionPostFails() {
given(answerRepository.existsByQuestionPostId(questionPostId)).willReturn(true);

//when & then
assertThrows(ValidationException.class,
ValidationException exception = assertThrows(ValidationException.class,
() -> questionPostService.deleteQuestionPost(questionPostId));

assertThat(exception.getCode())
.isEqualTo(QuestionPostErrorCode.CAN_NOT_DELETE_QUESTION_POST.getCode());
}
}

0 comments on commit b2b50d2

Please sign in to comment.