-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…r-user-caching
- Loading branch information
Showing
8 changed files
with
60 additions
and
44 deletions.
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -82,7 +82,7 @@ void given_email_when_getMember_then_returnMember() { | |
void given_memberId_when_getMemberCache_then_returnMemberPrincipal() { | ||
// given | ||
Long memberId = 1L; | ||
given(memberCacheRepository.findById(memberId)).willReturn(Optional.of(FixtureDto.createMemberPrincipal())); | ||
given(memberRepository.findById(memberId)).willReturn(Optional.of(Fixture.createMember())); | ||
// when | ||
MemberPrincipal memberPrincipal = memberService.getMemberCache(memberId); | ||
// then | ||
|
@@ -112,11 +112,9 @@ void given_EmailAndPassword_when_generateAccessToken_then_saveCacheAndReturnToke | |
String email = "[email protected]", password = "pw"; | ||
Member member = Fixture.createMember(); | ||
String accessToken = "accessToken"; | ||
MemberPrincipal memberPrincipal = MemberPrincipal.fromEntity(member); | ||
given(memberRepository.findByEmail(email)).willReturn(Optional.of(member)); | ||
given(encoder.matches(password, member.getPassword())).willReturn(true); | ||
given(tokenProvider.generateAccessToken(member.getId())).willReturn(accessToken); | ||
given(memberCacheRepository.save(memberPrincipal)).willReturn(memberPrincipal); | ||
// when | ||
LoginResponse loginResponse = memberService.signIn(email, password); | ||
// then | ||
|
@@ -180,7 +178,6 @@ void given_memberRequestAndImgFile_when_updateMember_then_memberRequestEqualsToU | |
MockMultipartFile imgFile = Fixture.createMultipartFileOfImage("test_image_content"); | ||
MemberRequest memberRequest = FixtureDto.createMemberRequest(); | ||
given(memberRepository.findById(memberId)).willReturn(Optional.of(Fixture.createMember())); | ||
given(memberCacheRepository.save(any(MemberPrincipal.class))).willReturn(memberPrincipal); | ||
willDoNothing().given(fileService).uploadFile(eq(imgFile), anyString()); | ||
// when | ||
Member member = memberService.updateMember(memberPrincipal, memberRequest, imgFile); | ||
|
@@ -270,7 +267,6 @@ void given_changePasswordRequestAndPrincipal_when_unmatchedOldPassword_then_thro | |
void given_memberId_when_then_deleteUserCache() { | ||
//given | ||
Long memberId = 123L; | ||
willDoNothing().given(memberCacheRepository).deleteById(memberId); | ||
//when | ||
assertThatCode(() -> memberService.logout(memberId)).doesNotThrowAnyException(); | ||
//then | ||
|