Test 도중 이상하게 ResponseFileds를 받지 못하는 문제가 있다. 혹시나 해서 postman으로 테스트 해보았는데 아래와 같이 잘나온다 ...
테스트는 성공하지만 responseFields 가 없다며 계속해서 오류를 뱉는다 ... ㅜㅜ 무엇이 문제일까
@Test
void loginUser() throws Exception {
final UserLoginRequest userLoginRequest =
UserLoginRequest.builder().socialToken("Asd823daz").pushToken("Wesdf0898dfa").build();
final UserLoginResponse userLoginResponse =
UserLoginResponse.builder().coupleToken("7E0U7W").socialToken("Asd823daz").build();
when(userFindService.loginUser(userLoginRequest)).thenReturn(userLoginResponse);
this.mockMvc
.perform(
post("/login")
.content(this.objectMapper.writeValueAsString(userLoginRequest))
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andDo(print())
.andDo(
document(
"user-login",
requestFields(
fieldWithPath("socialToken").description("소셜 토큰"),
fieldWithPath("pushToken").description("푸시 토큰").optional()),
responseFields(
fieldWithPath("socialToken").description("소셜 토큰"),
fieldWithPath("coupleToken").description("커플 토큰"))));
}
* 해결되면 해결방법과 같이 다시 수정 예정ㅜ ㅜ
반응형
'Project > DARLING' 카테고리의 다른 글
8. Service (0) | 2022.02.16 |
---|---|
7. CI/CD 계획 (0) | 2022.02.09 |
5. Spring REST Docs 사용 (0) | 2022.01.24 |
4. 연관관계 - OneToMany (0) | 2022.01.23 |
3. 연관관계 - ManyToOne (0) | 2022.01.23 |