Skip to content

Commit

Permalink
GETP-234 refactor: test fixture 모듈이 MemberId 클래스를 사용하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
scv1702 committed Sep 17, 2024
1 parent 5018cbc commit daa6cd7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
18 changes: 6 additions & 12 deletions src/test/java/es/princip/getp/fixture/client/ClientFixture.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
package es.princip.getp.fixture.client;

import es.princip.getp.domain.client.model.Client;
import es.princip.getp.domain.member.model.MemberId;

import java.util.List;
import java.util.stream.LongStream;

import static es.princip.getp.fixture.client.AddressFixture.address;
import static es.princip.getp.fixture.client.BankAccountFixture.bankAccount;
import static es.princip.getp.fixture.common.EmailFixture.email;

public class ClientFixture {

public static Client client(final Long memberId) {
public static Client client(final MemberId memberId) {
return Client.builder()
.memberId(memberId)
.email(email())
.address(AddressFixture.address())
.bankAccount(BankAccountFixture.bankAccount())
.address(address())
.bankAccount(bankAccount())
.build();
}

public static List<Client> clientList(final int size, final Long memberIdBias) {
return LongStream.range(0, size)
.mapToObj(i -> client(memberIdBias + i))
.toList();
}
}
10 changes: 0 additions & 10 deletions src/test/java/es/princip/getp/fixture/member/MemberFixture.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
package es.princip.getp.fixture.member;

import es.princip.getp.domain.common.model.Email;
import es.princip.getp.domain.member.model.Member;
import es.princip.getp.domain.member.model.MemberType;

import java.util.List;
import java.util.stream.IntStream;

import static es.princip.getp.fixture.common.EmailFixture.email;

public class MemberFixture {

public static Member member(final MemberType memberType) {
return Member.of(email(), PasswordFixture.password(), memberType);
}

public static List<Member> memberList(final int size, final int bias, final MemberType memberType) {
return IntStream.range(bias, bias + size)
.mapToObj(i -> Member.of(Email.from("test" + i + "@example.com"), PasswordFixture.password(), memberType))
.toList();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package es.princip.getp.fixture.member;

import es.princip.getp.domain.member.model.MemberId;
import es.princip.getp.domain.member.model.ProfileImage;

import java.net.URI;
Expand All @@ -10,8 +11,8 @@ public class ProfileImageFixture {

private static final String FILE_NAME = "image.jpg";

public static ProfileImage profileImage(final Long memberId) {
final String profileImageUri = String.format("/images/%d/profile/%s", memberId, FILE_NAME);
public static ProfileImage profileImage(final MemberId memberId) {
final String profileImageUri = String.format("/images/%d/profile/%s", memberId.getValue(), FILE_NAME);
final URI uri = URI.create(BASE_URI).resolve(profileImageUri);
return ProfileImage.from(uri.toString());
}
Expand Down
14 changes: 3 additions & 11 deletions src/test/java/es/princip/getp/fixture/people/PeopleFixture.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package es.princip.getp.fixture.people;

import es.princip.getp.domain.member.model.MemberId;
import es.princip.getp.domain.people.model.People;
import es.princip.getp.domain.people.model.PeopleInfo;
import es.princip.getp.domain.people.model.PeopleProfileData;
import es.princip.getp.domain.people.model.PeopleType;

import java.util.List;
import java.util.stream.LongStream;

import static es.princip.getp.fixture.common.EmailFixture.email;
import static es.princip.getp.fixture.common.HashtagFixture.hashtags;
import static es.princip.getp.fixture.common.TechStackFixture.techStacks;
Expand All @@ -22,7 +20,7 @@ private static PeopleInfo peopleInfo(final PeopleType peopleType) {
return new PeopleInfo(email(), peopleType);
}

public static People people(Long memberId, PeopleType peopleType) {
public static People people(final MemberId memberId, final PeopleType peopleType) {
final People people = People.of(memberId, peopleInfo(peopleType));
final PeopleProfileData data = new PeopleProfileData(
introduction(),
Expand All @@ -36,13 +34,7 @@ public static People people(Long memberId, PeopleType peopleType) {
return people;
}

public static People peopleWithoutProfile(Long memberId, PeopleType peopleType) {
public static People peopleWithoutProfile(final MemberId memberId, final PeopleType peopleType) {
return People.of(memberId, peopleInfo(peopleType));
}

public static List<People> peopleList(int size, Long memberIdBias, PeopleType peopleType) {
return LongStream.range(0, size)
.mapToObj(i -> people(memberIdBias + i, peopleType))
.toList();
}
}

0 comments on commit daa6cd7

Please sign in to comment.