-
Notifications
You must be signed in to change notification settings - Fork 1
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
[#47] feat: test 코드 member -> memberInfoDto로 변경
- Loading branch information
Showing
5 changed files
with
82 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
import com.jeju.nanaland.domain.experience.entity.Experience; | ||
import com.jeju.nanaland.domain.favorite.dto.FavoriteResponse; | ||
import com.jeju.nanaland.domain.favorite.repository.FavoriteRepository; | ||
import com.jeju.nanaland.domain.member.dto.MemberResponse.MemberInfoDto; | ||
import com.jeju.nanaland.domain.member.entity.Member; | ||
import com.jeju.nanaland.domain.member.entity.Provider; | ||
import com.jeju.nanaland.global.exception.BadRequestException; | ||
|
@@ -34,6 +35,7 @@ class ExperienceServiceTest { | |
|
||
Language language; | ||
Member member1, member2; | ||
MemberInfoDto memberInfoDto1, memberInfoDto2; | ||
Experience experience; | ||
Category category; | ||
|
||
|
@@ -67,6 +69,11 @@ void init() { | |
.build(); | ||
em.persist(member1); | ||
|
||
memberInfoDto1 = MemberInfoDto.builder() | ||
.language(language) | ||
.member(member1) | ||
.build(); | ||
|
||
member2 = Member.builder() | ||
.email("[email protected]") | ||
.provider(Provider.KAKAO) | ||
|
@@ -77,6 +84,11 @@ void init() { | |
.build(); | ||
em.persist(member2); | ||
|
||
memberInfoDto2 = MemberInfoDto.builder() | ||
.language(language) | ||
.member(member2) | ||
.build(); | ||
|
||
experience = Experience.builder() | ||
.imageFile(imageFile1) | ||
.build(); | ||
|
@@ -96,11 +108,11 @@ void toggleLikeStatusTest() { | |
* member1 : toggleLikeStatus 2번 적용 | ||
* member2 : toggleLikeStatus 1번 적용 | ||
*/ | ||
experienceService.toggleLikeStatus(member1, experience.getId()); | ||
FavoriteResponse.StatusDto result1 = experienceService.toggleLikeStatus(member1, | ||
experienceService.toggleLikeStatus(memberInfoDto1, experience.getId()); | ||
FavoriteResponse.StatusDto result1 = experienceService.toggleLikeStatus(memberInfoDto1, | ||
experience.getId()); | ||
|
||
FavoriteResponse.StatusDto result2 = experienceService.toggleLikeStatus(member2, | ||
FavoriteResponse.StatusDto result2 = experienceService.toggleLikeStatus(memberInfoDto2, | ||
experience.getId()); | ||
|
||
/** | ||
|
@@ -127,7 +139,7 @@ void toggleLikeStatusFailedWithNoSuchPostIdTest() { | |
* | ||
* toggleLikeStatus 요청 시 BadRequestException 발생 | ||
*/ | ||
Assertions.assertThatThrownBy(() -> experienceService.toggleLikeStatus(member1, postId)) | ||
Assertions.assertThatThrownBy(() -> experienceService.toggleLikeStatus(memberInfoDto1, postId)) | ||
.isInstanceOf(BadRequestException.class); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
import com.jeju.nanaland.domain.common.entity.Locale; | ||
import com.jeju.nanaland.domain.favorite.dto.FavoriteResponse; | ||
import com.jeju.nanaland.domain.favorite.repository.FavoriteRepository; | ||
import com.jeju.nanaland.domain.member.dto.MemberResponse.MemberInfoDto; | ||
import com.jeju.nanaland.domain.member.entity.Member; | ||
import com.jeju.nanaland.domain.member.entity.Provider; | ||
import com.jeju.nanaland.domain.nana.entity.Nana; | ||
|
@@ -34,6 +35,7 @@ class NanaServiceTest { | |
|
||
Language language; | ||
Member member1, member2; | ||
MemberInfoDto memberInfoDto1, memberInfoDto2; | ||
Nana nana; | ||
Category category; | ||
|
||
|
@@ -67,6 +69,11 @@ void init() { | |
.build(); | ||
em.persist(member1); | ||
|
||
memberInfoDto1 = MemberInfoDto.builder() | ||
.language(language) | ||
.member(member1) | ||
.build(); | ||
|
||
member2 = Member.builder() | ||
.email("[email protected]") | ||
.provider(Provider.KAKAO) | ||
|
@@ -77,6 +84,11 @@ void init() { | |
.build(); | ||
em.persist(member2); | ||
|
||
memberInfoDto2 = MemberInfoDto.builder() | ||
.language(language) | ||
.member(member2) | ||
.build(); | ||
|
||
nana = Nana.builder() | ||
.version("version1") | ||
.build(); | ||
|
@@ -96,11 +108,11 @@ void toggleLikeStatusTest() { | |
* member1 : toggleLikeStatus 2번 적용 | ||
* member2 : toggleLikeStatus 1번 적용 | ||
*/ | ||
nanaService.toggleLikeStatus(member1, nana.getId()); | ||
FavoriteResponse.StatusDto result1 = nanaService.toggleLikeStatus(member1, | ||
nanaService.toggleLikeStatus(memberInfoDto1, nana.getId()); | ||
FavoriteResponse.StatusDto result1 = nanaService.toggleLikeStatus(memberInfoDto1, | ||
nana.getId()); | ||
|
||
FavoriteResponse.StatusDto result2 = nanaService.toggleLikeStatus(member2, | ||
FavoriteResponse.StatusDto result2 = nanaService.toggleLikeStatus(memberInfoDto2, | ||
nana.getId()); | ||
|
||
/** | ||
|
@@ -127,7 +139,7 @@ void toggleLikeStatusFailedWithNoSuchPostIdTest() { | |
* | ||
* toggleLikeStatus 요청 시 BadRequestException 발생 | ||
*/ | ||
Assertions.assertThatThrownBy(() -> nanaService.toggleLikeStatus(member1, postId)) | ||
Assertions.assertThatThrownBy(() -> nanaService.toggleLikeStatus(memberInfoDto1, postId)) | ||
.isInstanceOf(BadRequestException.class); | ||
} | ||
} |
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