-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#9] test : user controller 인증번호 확인 테스트 추가
- Loading branch information
Showing
1 changed file
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -112,7 +113,7 @@ void sendVerificationEmailInputTest() throws Exception { | |
} | ||
|
||
@Test | ||
@DisplayName("[FAIL] 이메일 유효성 검증 태스트") | ||
@DisplayName("[FAIL] 이메일 유효성 검증 테스트") | ||
void sendVerificationEmailValidTest() throws Exception { | ||
|
||
//given | ||
|
@@ -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()); | ||
} | ||
} |