[Test] CustomOAuth2UserService 테스트를 loadUser() 실제 호출 기준으로 재작성해 findOrCreate 검증 - #203
Open
minseo0313 wants to merge 4 commits into
Open
[Test] CustomOAuth2UserService 테스트를 loadUser() 실제 호출 기준으로 재작성해 findOrCreate 검증#203minseo0313 wants to merge 4 commits into
minseo0313 wants to merge 4 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
💡 개요
CustomOAuth2UserServiceTest가 노션 AUTH-004 명세와 달리
loadUser()를 실행하지 않고private
createUserInfo()만 리플렉션으로 호출해,findOrCreate()호출 검증과providerId=null예외 분기가 테스트되지 않던 문제를 수정합니다.🪐 주요 변경 사항
customOAuth2UserService.loadUser(userRequest)실제 호출 기준으로 재작성RestOperationsmock을setRestOperations로 주입해super.loadUser()의 userinfo HTTP 호출만 격리findOrCreate()호출 인자 검증 및OAuth2UserAdapter반환 검증 추가✅ 상세 내용
loadUser()호출 후verify(userService).findOrCreate(argThat(info -> provider/providerId 일치))+반환값
instanceof OAuth2UserAdapter검증loadUser()경유OAuth2AuthenticationException(Unsupported provider)발생 및
findOrCreate()미호출 검증loadUser()경유OAuth2AuthenticationException(Provider ID is missing)발생 및
findOrCreate()미호출 검증 — 기존 테스트가 커버하지 못하던CustomOAuth2UserService.loadUser()의 null 체크 분기를 실제로 실행MemberType,ReflectionTestUtils, wildcard) 및 불필요한spy()래핑 제거OAuth2UserInfoTest와 중복되어 제거🔔 참고 사항