-
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.
✅ [Test] 매너 정보 조회 API 분리로 인한 테스트 케이스 수정
- Loading branch information
1 parent
7214194
commit c1e77c3
Showing
4 changed files
with
85 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
import com.gamegoo.gamegoo_v2.social.manner.dto.request.MannerInsertRequest; | ||
import com.gamegoo.gamegoo_v2.social.manner.dto.request.MannerUpdateRequest; | ||
import com.gamegoo.gamegoo_v2.social.manner.dto.response.MannerInsertResponse; | ||
import com.gamegoo.gamegoo_v2.social.manner.dto.response.MannerKeywordListResponse; | ||
import com.gamegoo.gamegoo_v2.social.manner.dto.response.MannerRatingResponse; | ||
import com.gamegoo.gamegoo_v2.social.manner.dto.response.MannerResponse; | ||
import com.gamegoo.gamegoo_v2.social.manner.dto.response.MannerUpdateResponse; | ||
|
@@ -443,6 +444,7 @@ void insertNegativeMannerRatingSucceedsWhenMannerLevelDown() { | |
eq(NotificationTypeTitle.MANNER_LEVEL_DOWN), any(Member.class), eq(1)); | ||
}); | ||
} | ||
|
||
} | ||
|
||
@Nested | ||
|
@@ -806,6 +808,7 @@ void updateMannerRatingSucceedsWhenNegativeKeyword() { | |
verify(notificationService, times(0)).createMannerLevelNotification(any(), any(Member.class), any()); | ||
}); | ||
} | ||
|
||
} | ||
|
||
@Nested | ||
|
@@ -884,17 +887,18 @@ void getMannerRatingSucceedsWhenNegativeNotExist() { | |
assertThat(response.getMannerRatingId()).isNull(); | ||
assertThat(response.getMannerKeywordIdList()).isEmpty(); | ||
} | ||
|
||
} | ||
|
||
@Nested | ||
@DisplayName("회원 매너 정보 조회") | ||
class GetMannerInfoTest { | ||
@DisplayName("회원 매너 레벨 정보 조회") | ||
class GetMannerLevelInfoTest { | ||
|
||
@DisplayName("실패: 대상 회원을 찾을 수 없는 경우 예외가 발생한다.") | ||
@Test | ||
void getMannerInfo_shouldThrownWhenMemberNotFound() { | ||
// when // then | ||
assertThatThrownBy(() -> mannerFacadeService.getMannerInfo(1000L)) | ||
assertThatThrownBy(() -> mannerFacadeService.getMannerLevelInfo(1000L)) | ||
.isInstanceOf(MemberException.class) | ||
.hasMessage(ErrorCode.MEMBER_NOT_FOUND.getMessage()); | ||
} | ||
|
@@ -903,16 +907,12 @@ void getMannerInfo_shouldThrownWhenMemberNotFound() { | |
@Test | ||
void getMannerInfoSucceedsWhenNoMannerRating() { | ||
// when | ||
MannerResponse response = mannerFacadeService.getMannerInfo(member.getId()); | ||
MannerResponse response = mannerFacadeService.getMannerLevelInfo(member.getId()); | ||
|
||
// then | ||
assertThat(response.getMannerLevel()).isEqualTo(1); | ||
assertThat(response.getMannerRank()).isNull(); | ||
assertThat(response.getMannerRatingCount()).isEqualTo(0); | ||
assertThat(response.getMannerKeywords()) | ||
.isNotNull() | ||
.hasSize(12) | ||
.allSatisfy(mannerKeywordResponse -> assertThat(mannerKeywordResponse.getCount()).isEqualTo(0)); | ||
} | ||
|
||
@DisplayName("성공: 받은 매너 평가가 있는 경우") | ||
|
@@ -932,13 +932,63 @@ void getMannerInfoSucceeds() { | |
memberRepository.save(member); | ||
|
||
// when | ||
MannerResponse response = mannerFacadeService.getMannerInfo(member.getId()); | ||
MannerResponse response = mannerFacadeService.getMannerLevelInfo(member.getId()); | ||
|
||
// then | ||
assertThat(response.getMannerLevel()).isEqualTo(1); | ||
assertThat(response.getMannerRank()).isEqualTo(50.0); | ||
assertThat(response.getMannerRatingCount()).isEqualTo(2); | ||
} | ||
|
||
} | ||
|
||
@Nested | ||
@DisplayName("회원 매너 키워드 정보 조회") | ||
class GetMannerKeywordInfoTest { | ||
|
||
@DisplayName("실패: 대상 회원을 찾을 수 없는 경우 예외가 발생한다.") | ||
@Test | ||
void getMannerKeywordInfo_shouldThrownWhenMemberNotFound() { | ||
// when // then | ||
assertThatThrownBy(() -> mannerFacadeService.getMannerKeywordInfo(1000L)) | ||
.isInstanceOf(MemberException.class) | ||
.hasMessage(ErrorCode.MEMBER_NOT_FOUND.getMessage()); | ||
} | ||
|
||
@DisplayName("성공: 받은 매너 평가가 없는 경우") | ||
@Test | ||
void getMannerKeywordInfoSucceedsWhenNoMannerRating() { | ||
// when | ||
MannerKeywordListResponse response = mannerFacadeService.getMannerKeywordInfo(member.getId()); | ||
|
||
// then | ||
assertThat(response.getMannerKeywords()) | ||
.isNotNull() | ||
.hasSize(12) | ||
.allSatisfy(mannerKeywordResponse -> | ||
assertThat(mannerKeywordResponse.getCount()).isEqualTo(0)); | ||
} | ||
|
||
@DisplayName("성공: 받은 매너 평가가 있는 경우") | ||
@Test | ||
void getMannerKeywordInfoSucceeds() { | ||
// given | ||
Member targetMember1 = createMember("[email protected]", "targetMember1"); | ||
Member targetMember2 = createMember("[email protected]", "targetMember2"); | ||
Member targetMember3 = createMember("[email protected]", "targetMember3"); | ||
|
||
createMannerRating(List.of(1L, 2L, 3L, 4L, 5L, 6L), targetMember1, member, true); | ||
createMannerRating(List.of(1L, 2L, 3L), targetMember2, member, true); | ||
createMannerRating(List.of(7L, 8L), targetMember3, member, false); | ||
|
||
member.updateMannerScore(5); | ||
member.updateMannerRank(50.0); | ||
memberRepository.save(member); | ||
|
||
// when | ||
MannerKeywordListResponse response = mannerFacadeService.getMannerKeywordInfo(member.getId()); | ||
|
||
// then | ||
Map<Long, Integer> assertMap = new HashMap<>(); | ||
assertMap.put(1L, 2); | ||
assertMap.put(2L, 2); | ||
|