-
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.
Feat: 유저 프로필 비공개 시 게시물도 비공개 상태로 하는 기능 구현 (#123)
* #122 - feat: 멤버 프로필이 private일 때 게시글도 private으로 하는 기능 구현 게시글 조회시 멤버의 프로필 상태를 확인한다. 멤버 프로필 변경 api 구현 * #122 - test: 멤버 프로필 상태에 따라 게시글 조회 기능 테스트 작성 * #122 - refactor: 오타 수정 * #122 - feat: join을 명시적으로 하게 함
- Loading branch information
Showing
8 changed files
with
94 additions
and
7 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
45 changes: 45 additions & 0 deletions
45
src/test/java/cotato/bookitlist/member/service/MemberServiceTest.java
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package cotato.bookitlist.member.service; | ||
|
||
import cotato.bookitlist.member.domain.Member; | ||
import cotato.bookitlist.member.domain.ProfileStatus; | ||
import cotato.bookitlist.member.repository.MemberRepository; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static cotato.bookitlist.fixture.MemberFixture.createMember; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.BDDMockito.given; | ||
import static org.mockito.BDDMockito.then; | ||
|
||
@DisplayName("멤버 서비스 테스트") | ||
@ExtendWith(MockitoExtension.class) | ||
class MemberServiceTest { | ||
|
||
|
||
@InjectMocks | ||
MemberService sut; | ||
@Mock | ||
MemberRepository memberRepository; | ||
|
||
@Test | ||
@DisplayName("멤버 id를 이용해 멤버의 ProfileStatus를 변경한다.") | ||
void givenMemberId_whenChangingProfileStatus_thenChangeProfileStatus() throws Exception{ | ||
//given | ||
Long memberId = 1L; | ||
Member member = createMember(memberId); | ||
given(memberRepository.getReferenceById(memberId)).willReturn(member); | ||
|
||
//when | ||
sut.changeProfileStatus(memberId); | ||
|
||
//then | ||
then(memberRepository).should().getReferenceById(memberId); | ||
assertThat(member.getProfileStatus()).isEqualTo(ProfileStatus.PRIVATE); | ||
} | ||
|
||
|
||
} |
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