Skip to content

Commit

Permalink
RAC-449 fix : 테스트 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ywj9811 committed Oct 23, 2024
1 parent 99dd2b9 commit 41f2900
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,30 +87,6 @@ void updateInfo() throws Exception {
.andExpect(jsonPath("$.message").value(UPDATE_USER_INFO.getMessage()));
}

@Test
@DisplayName("잘못된 번호로 수정할 수 없다")
@WithMockUser
void updateInvalidPhoneNumber() throws Exception {
UserInfoRequest userInfoRequest = new UserInfoRequest("new_profile", "new후배", "phoneNumber");
String request = objectMapper.writeValueAsString(
userInfoRequest
);

willThrow(new PhoneNumberException())
.given(userManageUseCase)
.updateInfo(any(), any());

mvc.perform(patch("/user/me/info")
.with(csrf())
.header(HttpHeaders.AUTHORIZATION, BEARER )
.content(request)
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.code").value(UserResponseCode.INVALID_PHONE_NUMBER.getCode()))
.andExpect(jsonPath("$.message").value(UserResponseMessage.INVALID_PHONE_NUMBER.getMessage()));
}

@ParameterizedTest
@ValueSource(booleans = {true, false})
@WithMockUser
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/postgraduate/support/ControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.postgraduate.domain.member.user.application.usecase.UserMyPageUseCase;
import com.postgraduate.domain.member.user.presentation.UserController;
import com.postgraduate.global.aop.lock.DistributeLockAspect;
import com.postgraduate.global.exception.GlobalExceptionHandler;
import com.postgraduate.global.slack.SlackLogErrorMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
Expand Down Expand Up @@ -79,6 +80,8 @@ public class ControllerTest {
protected SlackLogErrorMessage slackLogErrorMessage;
@MockBean
protected DistributeLockAspect distributeLockAspect;
@MockBean
protected GlobalExceptionHandler globalExceptionHandler;
protected Resource resource = new Resource();

}

0 comments on commit 41f2900

Please sign in to comment.