Skip to content

Commit

Permalink
test: 변경된 내용을 테스트 코드에 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
BGuga committed Jul 23, 2023
1 parent 5e25314 commit 4637296
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;

import org.junit.jupiter.api.Test;
import wooteco.prolog.common.exception.BadRequestCode;
import wooteco.prolog.common.exception.BadRequestException;

class MemberGroupTest {

Expand All @@ -23,8 +25,8 @@ class MemberGroupTest {
MemberGroup memberGroup = new MemberGroup(null, "테스트", "test");

assertThatThrownBy(memberGroup::groupType)
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("그룹이 포함되는 타입이 없습니다. id=null");
.isInstanceOf(BadRequestException.class)
.hasMessage("해당 그룹의 타입을 결정할 수 없습니다.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import wooteco.prolog.common.exception.BadRequestCode;
import wooteco.prolog.common.exception.BadRequestException;
import wooteco.prolog.member.application.MemberService;
import wooteco.prolog.member.domain.Member;
Expand Down Expand Up @@ -109,7 +110,7 @@ void deleteEssayAnswer_fail() {

//when,then
assertThatThrownBy(() -> essayAnswerService.deleteEssayAnswer(1L, 1L))
.isInstanceOf(IllegalArgumentException.class);
.isInstanceOf(BadRequestException.class);
}

@DisplayName("deleteEssayAnswer 에서 answerId memberId 에 매핑되는 EssayAnswer 가 있다면 삭제한다")
Expand All @@ -135,7 +136,7 @@ void getById_fail() {

//when,then
assertThatThrownBy(() -> essayAnswerService.getById(1L))
.isInstanceOf(IllegalArgumentException.class);
.isInstanceOf(BadRequestException.class);
}

@DisplayName("getById 에서 answerId 에 해당하는 EssayAnswer 가있다면 반환해준다")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import wooteco.prolog.common.exception.BadRequestCode;
import wooteco.prolog.common.exception.BadRequestException;
import wooteco.prolog.member.domain.Member;

public class EssayAnswerTest {
class EssayAnswerTest {

@ValueSource(strings = {"", " "})
@ParameterizedTest
Expand All @@ -19,8 +21,8 @@ public class EssayAnswerTest {

//expect
assertThatThrownBy(() -> essayAnswer.update(answer, member))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("답변 내용은 공백일 수 없습니다.");
.isInstanceOf(BadRequestException.class)
.hasMessage("답변은 공백일 수 없습니다.");
}

@Test
Expand All @@ -32,7 +34,7 @@ public class EssayAnswerTest {

//expect
assertThatThrownBy(() -> essayAnswer.update("answer", another))
.isInstanceOf(IllegalArgumentException.class)
.isInstanceOf(BadRequestException.class)
.hasMessage("본인이 작성한 답변만 수정할 수 있습니다.");
}

Expand Down

0 comments on commit 4637296

Please sign in to comment.