-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Weekly/10/Test/Refactor-MemberId] test 관련 member 도메인의 아이디 상수화 이외 1개 (#…
…86) * refactor: test 관련 memberId 상수화 * chore: 이제는 github action시 테스트도 수행함
- Loading branch information
Showing
17 changed files
with
314 additions
and
273 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.ktc2.cokaen.wouldyouin.global; | ||
package org.ktc2.cokaen.wouldyouin._global; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
@@ -66,13 +66,13 @@ public static CurationImage createValidCurationImage(Long id) { | |
|
||
public static class MemberDomain { | ||
|
||
public static final Long memberId = 1L; | ||
public static final Long curatorId = 5L; | ||
public static final Long hostId = 3L; | ||
public static final Long welcomeMemberId = 4L; | ||
public static final long validMemberId = 1L; | ||
public static final long validCuratorId = 2L; | ||
public static final long validHostId = 3L; | ||
public static final long validWelcomeMemberId = 4L; | ||
|
||
public static Member createValidMember() { | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(1L); | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(validMemberId); | ||
Member ret = Member.builder() | ||
.accountType(AccountType.kakao) | ||
.email("[email protected]") | ||
|
@@ -83,75 +83,63 @@ public static Member createValidMember() { | |
.gender("Men") | ||
.socialId("100100100100100") | ||
.build(); | ||
ReflectionTestUtils.setField(ret, "Id", 1L); | ||
ReflectionTestUtils.setField(ret, "Id", validMemberId); | ||
ReflectionTestUtils.setField(ret, "memberType", MemberType.normal); | ||
ReflectionTestUtils.setField(memberImage, "baseMember", ret); | ||
return ret; | ||
} | ||
|
||
public static Member createValidWelcomeMember() { | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(4L); | ||
Member ret = Member.builder() | ||
.accountType(AccountType.kakao) | ||
.email("member2@example.com") | ||
.nickname("nick_normal_333") | ||
.phone("010-4414-1144") | ||
public static Curator createValidCurator() { | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(validCuratorId); | ||
Curator ret = Curator.curatorBuilder() | ||
.accountType(AccountType.google) | ||
.email("curator1@example.com") | ||
.nickname("nick_curator_12") | ||
.phone("010-4545-6767") | ||
.profileImage(memberImage) | ||
.area(Area.서울) | ||
.gender("Men") | ||
.socialId("456456456456") | ||
.area(Area.광주) | ||
.gender("Women") | ||
.socialId("200200200200200") | ||
.build(); | ||
ReflectionTestUtils.setField(ret, "Id", 4L); | ||
ReflectionTestUtils.setField(ret, "Id", validCuratorId); | ||
ReflectionTestUtils.setField(ret, "intro", "큐레이터 자기소개입니다."); | ||
ReflectionTestUtils.setField(ret, "hashtag", "#큐레이터#해시태그#입니다"); | ||
ReflectionTestUtils.setField(memberImage, "baseMember", ret); | ||
return ret; | ||
} | ||
|
||
public static Host createValidHost() { | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(3L); | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(validHostId); | ||
Host ret = Host.builder() | ||
.email("[email protected]") | ||
.nickname("nick_curator_12") | ||
.phone("010-4545-6767") | ||
.hashedPassword("hashed_password") | ||
.profileImage(memberImage) | ||
.build(); | ||
ReflectionTestUtils.setField(ret, "Id", 3L); | ||
ReflectionTestUtils.setField(ret, "Id", validHostId); | ||
ReflectionTestUtils.setField(ret, "intro", "주최자 자기소개입니다."); | ||
ReflectionTestUtils.setField(ret, "hashtag", "#주최자#해시태그#입니다"); | ||
ReflectionTestUtils.setField(memberImage, "baseMember", ret); | ||
return ret; | ||
} | ||
|
||
public static Curator createValidCurator() { | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(2L); | ||
Curator ret = Curator.curatorBuilder() | ||
.accountType(AccountType.google) | ||
.email("curator1@example.com") | ||
.nickname("nick_curator_12") | ||
.phone("010-4545-6767") | ||
public static Member createValidWelcomeMember() { | ||
MemberImage memberImage = ImageDomain.createValidMemberImage(validWelcomeMemberId); | ||
Member ret = Member.builder() | ||
.accountType(AccountType.kakao) | ||
.email("member2@example.com") | ||
.nickname("nick_normal_333") | ||
.phone("010-4414-1144") | ||
.profileImage(memberImage) | ||
.area(Area.광주) | ||
.gender("Women") | ||
.socialId("200200200200200") | ||
.area(Area.서울) | ||
.gender("Men") | ||
.socialId("456456456456") | ||
.build(); | ||
ReflectionTestUtils.setField(ret, "Id", 2L); | ||
ReflectionTestUtils.setField(ret, "intro", "큐레이터 자기소개입니다."); | ||
ReflectionTestUtils.setField(ret, "hashtag", "#큐레이터#해시태그#입니다"); | ||
ReflectionTestUtils.setField(ret, "Id", validWelcomeMemberId); | ||
ReflectionTestUtils.setField(memberImage, "baseMember", ret); | ||
return ret; | ||
} | ||
|
||
public static CurationCuratorResponse createCurationCuratorResponse() { | ||
return CurationCuratorResponse.builder() | ||
.nickname("nick_curator_12") | ||
.email("[email protected]") | ||
.phone("010-4545-6767") | ||
.profileImageUrl("image2.com") | ||
.intro("큐레이터 자기소개입니다.") | ||
.likes(0) | ||
.hashtags(List.of("#큐레이터", "#해시태그", "#입니다")) | ||
.build(); | ||
} | ||
} | ||
|
||
public static class EventDomain { | ||
|
@@ -302,9 +290,22 @@ public static CurationEditRequest createValidCurationEditRequest() { | |
.build(); | ||
} | ||
|
||
public static CurationCuratorResponse createCurationCuratorResponse() { | ||
Curator curator = MemberDomain.createValidCurator(); | ||
return CurationCuratorResponse.builder() | ||
.nickname(curator.getNickname()) | ||
.email(curator.getEmail()) | ||
.phone(curator.getPhone()) | ||
.profileImageUrl(curator.getProfileImageUrl()) | ||
.intro(curator.getIntro()) | ||
.likes(curator.getLikes()) | ||
.hashtags(curator.getHashTagList()) | ||
.build(); | ||
} | ||
|
||
public static CurationResponse createValidCurationResponse() { | ||
return CurationResponse.builder() | ||
.curator(MemberDomain.createCurationCuratorResponse()) | ||
.curator(createCurationCuratorResponse()) | ||
.title("title") | ||
.content("content") | ||
.curationCards(List.of(createCurationCardResponse1())) | ||
|
2 changes: 1 addition & 1 deletion
2
...c2/cokaen/wouldyouin/global/TestUtil.java → ...2/cokaen/wouldyouin/_global/TestUtil.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.ktc2.cokaen.wouldyouin.global; | ||
package org.ktc2.cokaen.wouldyouin._global; | ||
|
||
public class TestUtil { | ||
|
||
|
6 changes: 3 additions & 3 deletions
6
...in/global/mockMember/WithMockCurator.java → ...n/_global/mockMember/WithMockCurator.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.ktc2.cokaen.wouldyouin.global.mockMember; | ||
package org.ktc2.cokaen.wouldyouin._global.mockMember; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import org.ktc2.cokaen.wouldyouin.global.TestData; | ||
import org.ktc2.cokaen.wouldyouin._global.TestData.MemberDomain; | ||
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@WithMockCustomUser(memberId = 5L, memberType = MemberType.curator) | ||
@WithMockCustomUser(memberId = MemberDomain.validCuratorId, memberType = MemberType.curator) | ||
public @interface WithMockCurator { | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
...MockCustomUserSecurityContextFactory.java → ...MockCustomUserSecurityContextFactory.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
6 changes: 3 additions & 3 deletions
6
...youin/global/mockMember/WithMockHost.java → ...ouin/_global/mockMember/WithMockHost.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.ktc2.cokaen.wouldyouin.global.mockMember; | ||
package org.ktc2.cokaen.wouldyouin._global.mockMember; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import org.ktc2.cokaen.wouldyouin.global.TestData; | ||
import org.ktc2.cokaen.wouldyouin._global.TestData.MemberDomain; | ||
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@WithMockCustomUser(memberId = 3L, memberType = MemberType.host) | ||
@WithMockCustomUser(memberId = MemberDomain.validHostId, memberType = MemberType.host) | ||
public @interface WithMockHost { | ||
|
||
} |
6 changes: 3 additions & 3 deletions
6
...uin/global/mockMember/WithMockMember.java → ...in/_global/mockMember/WithMockMember.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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.ktc2.cokaen.wouldyouin.global.mockMember; | ||
package org.ktc2.cokaen.wouldyouin._global.mockMember; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import org.ktc2.cokaen.wouldyouin.global.TestData; | ||
import org.ktc2.cokaen.wouldyouin._global.TestData.MemberDomain; | ||
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@WithMockCustomUser(memberId = 1L, memberType = MemberType.normal) | ||
@WithMockCustomUser(memberId = MemberDomain.validMemberId, memberType = MemberType.normal) | ||
public @interface WithMockMember { | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/test/java/org/ktc2/cokaen/wouldyouin/_global/mockMember/WithMockWelcomeMember.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,12 @@ | ||
package org.ktc2.cokaen.wouldyouin._global.mockMember; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import org.ktc2.cokaen.wouldyouin._global.TestData.MemberDomain; | ||
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@WithMockCustomUser(memberId = MemberDomain.validWelcomeMemberId, memberType = MemberType.welcome) | ||
public @interface WithMockWelcomeMember { | ||
|
||
} |
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
Oops, something went wrong.