Skip to content

Commit

Permalink
[#9] test : user controller 인증번호 확인 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
princenim committed Mar 29, 2024
1 parent 1457f8e commit 2185bfe
Showing 1 changed file with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kboticketing.kboticketing.dto.EmailRequestDto;
import com.kboticketing.kboticketing.dto.UserDto;
import com.kboticketing.kboticketing.dto.VerificationCodeDto;
import com.kboticketing.kboticketing.service.UserService;
import com.kboticketing.kboticketing.utils.exception.CustomException;
import com.kboticketing.kboticketing.utils.exception.ErrorCode;
Expand Down Expand Up @@ -112,7 +113,7 @@ void sendVerificationEmailInputTest() throws Exception {
}

@Test
@DisplayName("[FAIL] 이메일 유효성 검증 태스트")
@DisplayName("[FAIL] 이메일 유효성 검증 테스트")
void sendVerificationEmailValidTest() throws Exception {

//given
Expand All @@ -125,4 +126,37 @@ void sendVerificationEmailValidTest() throws Exception {
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest());
}

@Test
@DisplayName("[SUCCESS] 인증번호 확인 테스트")
void checkVerificationCodeTest() throws Exception {

//given
VerificationCodeDto verificationCodeDto = new VerificationCodeDto("[email protected]",
"123123");
String json = new ObjectMapper().writeValueAsString(verificationCodeDto);

//when, then
mockMvc.perform(post("/verification-code-validation")
.content(json)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
}


@Test
@DisplayName("[FAIL] 인증번호 미입력 테스트")
public void checkVerificationCodeValidationTest() throws Exception {

//given
VerificationCodeDto verificationCodeDto = new VerificationCodeDto("[email protected]",
"");
String json = new ObjectMapper().writeValueAsString(verificationCodeDto);

//when, then
mockMvc.perform(post("/verification-code-validation")
.content(json)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest());
}
}

0 comments on commit 2185bfe

Please sign in to comment.