Conversation
Wo-ogie
requested changes
Mar 26, 2024
Comment on lines
+112
to
+115
| public void changePassword(String password) { | ||
| this.password = password; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
이건 어떨까요?
Suggested change
| public void changePassword(String password) { | |
| this.password = password; | |
| } | |
| public void changePassword(String encodedPassword) { | |
| this.password = encodedPassword; | |
| } | |
Comment on lines
+167
to
+168
| UserDto userUpdated = userCommandService.updatePassword(userPrincipal.getUserId(), | ||
| updatePasswordRequest.getPassword()); |
Member
There was a problem hiding this comment.
요거 줄 정리 좀 해주시면 이쁠 거 같아요? 아니면 말구요 ㅎ;
Suggested change
| UserDto userUpdated = userCommandService.updatePassword(userPrincipal.getUserId(), | |
| updatePasswordRequest.getPassword()); | |
| UserDto userUpdated = userCommandService.updatePassword( | |
| userPrincipal.getUserId(), | |
| updatePasswordRequest.getPassword() | |
| ); |
Wo-ogie
approved these changes
Mar 26, 2024
Comment on lines
+261
to
+276
| @Test | ||
| void 주어진_유저_ID와_새로운_비밀번호로_유저의_비밀번호를_변경한다_존재하지_않는_유저라면_예외가_발생한다() throws Exception { | ||
| // given | ||
| Long userId = 1L; | ||
| String newPassword = "newPwd1234!!"; | ||
| given(userQueryService.getById(userId)).willThrow(UserNotFoundByIdException.class); | ||
|
|
||
| // when | ||
| Throwable t = catchThrowable(() -> sut.updatePassword(userId, newPassword)); | ||
|
|
||
| // then | ||
| then(userQueryService).should().getById(userId); | ||
| verifyEveryMocksShouldHaveNoMoreInteractions(); | ||
| assertThat(t).isInstanceOf(UserNotFoundByIdException.class); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
이거 아까 리뷰했던거랑 비슷한데요.
경우에 따라 조금씩 다를 수는 있는데 unit test에서 중점적인 것들 중 하나는 "테스트 대상의 역할만을 검증"하는 거라고 생각해요.
지금 이 케이스 같은 경우, 유저를 조회했는데 없는 경우 에러를 발생시키는 건 getById method의 책임이자 역할이라고 보기 때문에 굳이? 작성 안해도 되지 않나 싶습니다.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔥 Related Issue
🏃 Task
📄 Reference