From 014cf8cbc60f4554c6a2b092d0e621063b6fb88e Mon Sep 17 00:00:00 2001 From: Jaehyun Ahn <91878695+uwoobeat@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:38:06 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20VO=EC=9D=98=20=EC=A0=95=EC=A0=81=20?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A6=AC=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#804)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: Period 정적 팩토리 이름 변경 * refactor: Period VO를 common 패키지로 이동 * feat: Period를 상속 불가능하게 변경 * refactor: EqualsAndHashCode 사용하도록 변경 * refactor: 상수 위치 변경 * docs: 주석 추가 * refactor: Assignment VO 정적 팩토리 이름 변경 * refactor: MoneyInfo VO 정적 팩토리 이름 변경 * docs: 투두 주석 추가 * refactor: 준회원 승급조건 VO 정적 팩토리 이름 변경 * refactor: 정회원 승급조건 VO 정적 팩토리 이름 변경 * refactor: 커리큘럼 VO 정적 팩토리 이름 변경 * refactor: 정적 팩토리 이름 unsatisfied로 변경 * refactor: MoneyInfo 정적 팩토리 이름 변경 * refactor: Attendance 정적 팩토리 이름 변경 * refactor: Assignment 정적 팩토리 이름 변경 * refactor: 스터디상세 정적 팩토리 이름 변경 * refactor: 엔티티 정적 팩토리 이름 변경 * docs: 주석 및 로그 표현 수정 * refactor: 커리큘럼 VO 정적 팩토리 이름 변경 --- .../gdsc/domain/common/vo/Money.java | 4 +- .../domain => common}/vo/Period.java | 24 +++------- .../coupon/application/CouponService.java | 4 +- .../gdsc/domain/coupon/domain/Coupon.java | 2 +- .../domain/coupon/domain/IssuedCoupon.java | 2 +- .../listener/PingpongListener.java | 2 +- .../member/application/TestMemberService.java | 2 +- .../member/domain/AssociateRequirement.java | 2 +- .../gdsc/domain/member/domain/Member.java | 4 +- .../application/MembershipService.java | 2 +- .../domain/membership/domain/Membership.java | 4 +- .../membership/domain/RegularRequirement.java | 2 +- .../application/AdminRecruitmentService.java | 13 +++--- .../recruitment/domain/Recruitment.java | 4 +- .../recruitment/domain/RecruitmentRound.java | 2 +- .../dto/RecruitmentRoundFullDto.java | 2 +- .../study/application/MentorStudyService.java | 3 +- .../application/StudentStudyService.java | 2 +- .../gdsc/domain/study/domain/Attendance.java | 2 +- .../gdsc/domain/study/domain/Study.java | 4 +- .../study/domain/StudyAnnouncement.java | 2 +- .../gdsc/domain/study/domain/StudyDetail.java | 16 +++---- .../domain/study/domain/vo/Assignment.java | 19 ++++---- .../domain/study/domain/vo/Curriculum.java | 10 ++--- .../dto/response/CommonStudyResponse.java | 2 +- .../dto/response/StudyCurriculumResponse.java | 2 +- .../StudyStudentCurriculumResponse.java | 2 +- .../study/factory/StudyDomainFactory.java | 10 ++--- .../global/security/CustomUserService.java | 4 +- .../gdsc/domain/coupon/domain/CouponTest.java | 4 +- .../coupon/domain/IssuedCouponTest.java | 36 +++++++-------- .../application/AdminMemberServiceTest.java | 2 +- .../OnboardingMemberServiceTest.java | 4 +- .../member/dao/MemberRepositoryTest.java | 2 +- .../gdsc/domain/member/domain/MemberTest.java | 44 +++++++++---------- .../member/domain/MemberValidatorTest.java | 9 ++-- .../membership/domain/MembershipTest.java | 14 +++--- .../domain/MembershipValidatorTest.java | 15 +++---- .../AdminRecruitmentServiceTest.java | 11 ++--- .../domain/recruitment/domain/PeriodTest.java | 8 ++-- .../domain/RecruitmentRoundValidatorTest.java | 28 ++++++------ .../recruitment/domain/RecruitmentTest.java | 12 ++--- .../MentorStudyAchievementServiceTest.java | 14 +++--- .../MentorStudyDetailServiceTest.java | 8 ++-- .../application/MentorStudyServiceTest.java | 7 +-- .../StudentStudyHistoryServiceTest.java | 6 +-- .../domain/AssignmentHistoryGraderTest.java | 5 +-- .../study/domain/AssignmentHistoryTest.java | 5 +-- .../study/domain/AttendanceValidatorTest.java | 18 ++++---- .../StudyAssignmentHistoryValidatorTest.java | 5 +-- .../domain/study/domain/StudyDetailTest.java | 10 ++--- .../domain/StudyDetailValidatorTest.java | 26 ++++------- .../domain/study/domain/StudyHistoryTest.java | 10 ++--- .../domain/StudyHistoryValidatorTest.java | 18 ++++---- .../gdsc/domain/study/domain/StudyTest.java | 36 +++++++-------- .../study/domain/StudyValidatorTest.java | 18 ++++---- .../common/constant/RecruitmentConstant.java | 7 ++- .../global/common/constant/StudyConstant.java | 4 +- .../gdschongik/gdsc/helper/FixtureHelper.java | 23 +++++----- .../gdsc/helper/IntegrationTest.java | 28 ++++++------ 60 files changed, 263 insertions(+), 327 deletions(-) rename src/main/java/com/gdschongik/gdsc/domain/{recruitment/domain => common}/vo/Period.java (72%) diff --git a/src/main/java/com/gdschongik/gdsc/domain/common/vo/Money.java b/src/main/java/com/gdschongik/gdsc/domain/common/vo/Money.java index b03f4fdd8..33b7b1e05 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/common/vo/Money.java +++ b/src/main/java/com/gdschongik/gdsc/domain/common/vo/Money.java @@ -17,6 +17,8 @@ @NoArgsConstructor(access = AccessLevel.PROTECTED) public final class Money { + public static final Money ZERO = Money.from(BigDecimal.ZERO); + private BigDecimal amount; @Override @@ -34,8 +36,6 @@ private Money(BigDecimal amount) { this.amount = amount; } - public static final Money ZERO = Money.from(BigDecimal.ZERO); - public static Money from(BigDecimal amount) { validateAmountNotNull(amount); diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/vo/Period.java b/src/main/java/com/gdschongik/gdsc/domain/common/vo/Period.java similarity index 72% rename from src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/vo/Period.java rename to src/main/java/com/gdschongik/gdsc/domain/common/vo/Period.java index ded4a8352..c361c4801 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/vo/Period.java +++ b/src/main/java/com/gdschongik/gdsc/domain/common/vo/Period.java @@ -1,20 +1,22 @@ -package com.gdschongik.gdsc.domain.recruitment.domain.vo; +package com.gdschongik.gdsc.domain.common.vo; import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import com.gdschongik.gdsc.global.exception.CustomException; import jakarta.persistence.Embeddable; import java.time.LocalDateTime; -import java.util.Objects; import lombok.AccessLevel; import lombok.Builder; +import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; @Getter @Embeddable +@EqualsAndHashCode @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class Period { +public final class Period { + private LocalDateTime startDate; private LocalDateTime endDate; @@ -25,7 +27,7 @@ private Period(final LocalDateTime startDate, final LocalDateTime endDate) { this.endDate = endDate; } - public static Period createPeriod(LocalDateTime startDate, LocalDateTime endDate) { + public static Period of(LocalDateTime startDate, LocalDateTime endDate) { validatePeriod(startDate, endDate); return Period.builder().startDate(startDate).endDate(endDate).build(); } @@ -37,6 +39,7 @@ private static void validatePeriod(LocalDateTime startDate, LocalDateTime endDat } public boolean isOpen() { + // TODO: now를 내부에서 선언하지 않고 파라미터로 받아서 테스트 가능하도록 변경 LocalDateTime now = LocalDateTime.now(); return (now.isAfter(startDate) || now.isEqual(startDate)) && (now.isBefore(endDate) || now.isEqual(startDate)); } @@ -46,17 +49,4 @@ public void validatePeriodOverlap(LocalDateTime startDate, LocalDateTime endDate throw new CustomException(PERIOD_OVERLAP); } } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Period that = (Period) o; - return startDate == that.startDate && endDate == that.endDate; - } - - @Override - public int hashCode() { - return Objects.hash(startDate, endDate); - } } diff --git a/src/main/java/com/gdschongik/gdsc/domain/coupon/application/CouponService.java b/src/main/java/com/gdschongik/gdsc/domain/coupon/application/CouponService.java index b182589c1..9ad845d88 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/coupon/application/CouponService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/coupon/application/CouponService.java @@ -37,7 +37,7 @@ public class CouponService { @Transactional public void createCoupon(CouponCreateRequest request) { - Coupon coupon = Coupon.createCoupon(request.name(), Money.from(request.discountAmount())); + Coupon coupon = Coupon.create(request.name(), Money.from(request.discountAmount())); couponRepository.save(coupon); log.info("[CouponService] 쿠폰 생성: name={}, discountAmount={}", request.name(), request.discountAmount()); } @@ -59,7 +59,7 @@ public void createIssuedCoupon(CouponIssueRequest request) { List members = memberRepository.findAllById(request.memberIds()); List issuedCoupons = members.stream() - .map(member -> IssuedCoupon.issue(coupon, member)) + .map(member -> IssuedCoupon.create(coupon, member)) .toList(); issuedCouponRepository.saveAll(issuedCoupons); diff --git a/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/Coupon.java b/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/Coupon.java index 939e6d0c2..01eef4ae6 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/Coupon.java +++ b/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/Coupon.java @@ -37,7 +37,7 @@ private Coupon(String name, Money discountAmount) { this.discountAmount = discountAmount; } - public static Coupon createCoupon(String name, Money discountAmount) { + public static Coupon create(String name, Money discountAmount) { validateDiscountAmountPositive(discountAmount); return Coupon.builder().name(name).discountAmount(discountAmount).build(); } diff --git a/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCoupon.java b/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCoupon.java index dd9794460..b0f05b935 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCoupon.java +++ b/src/main/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCoupon.java @@ -51,7 +51,7 @@ private IssuedCoupon(Coupon coupon, Member member, Boolean hasRevoked) { this.hasRevoked = hasRevoked; } - public static IssuedCoupon issue(Coupon coupon, Member member) { + public static IssuedCoupon create(Coupon coupon, Member member) { return IssuedCoupon.builder() .coupon(coupon) .member(member) diff --git a/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/PingpongListener.java b/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/PingpongListener.java index 5dacbe56e..32b1413ad 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/PingpongListener.java +++ b/src/main/java/com/gdschongik/gdsc/domain/discord/application/listener/PingpongListener.java @@ -20,7 +20,7 @@ public void onMessageReceived(MessageReceivedEvent event) { User author = event.getAuthor(); TextChannel channel = event.getChannel().asTextChannel(); Message message = event.getMessage(); - String content = message.getContentRaw(); // get only textual content of message + String content = message.getContentRaw(); log.info("Message of {} in {}: {}", author.getName(), channel.getName(), message.getContentDisplay()); diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/application/TestMemberService.java b/src/main/java/com/gdschongik/gdsc/domain/member/application/TestMemberService.java index d30703784..5f77e6101 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/application/TestMemberService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/application/TestMemberService.java @@ -31,7 +31,7 @@ public void createTestMember(String githubHandle) { throw new CustomException(INTERNAL_SERVER_ERROR); } - Member guestMember = Member.createGuestMember(githubOauthId); + Member guestMember = Member.createGuest(githubOauthId); memberRepository.save(guestMember); } diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/domain/AssociateRequirement.java b/src/main/java/com/gdschongik/gdsc/domain/member/domain/AssociateRequirement.java index 648a495a9..f5653b3e1 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/domain/AssociateRequirement.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/domain/AssociateRequirement.java @@ -44,7 +44,7 @@ private AssociateRequirement( this.infoStatus = infoStatus; } - public static AssociateRequirement createRequirement() { + public static AssociateRequirement unsatisfied() { return AssociateRequirement.builder() .univStatus(UNSATISFIED) .discordStatus(UNSATISFIED) diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java b/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java index 44e684078..c9fc17235 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java @@ -106,8 +106,8 @@ private Member( this.associateRequirement = associateRequirement; } - public static Member createGuestMember(String oauthId) { - AssociateRequirement associateRequirement = AssociateRequirement.createRequirement(); + public static Member createGuest(String oauthId) { + AssociateRequirement associateRequirement = AssociateRequirement.unsatisfied(); return Member.builder() .oauthId(oauthId) .role(GUEST) diff --git a/src/main/java/com/gdschongik/gdsc/domain/membership/application/MembershipService.java b/src/main/java/com/gdschongik/gdsc/domain/membership/application/MembershipService.java index c0a0aa474..ef5e535de 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/membership/application/MembershipService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/membership/application/MembershipService.java @@ -69,7 +69,7 @@ public void submitMembership(Long recruitmentRoundId) { membershipValidator.validateMembershipSubmit(currentMember, recruitmentRound, isMembershipDuplicate); - Membership membership = Membership.createMembership(currentMember, recruitmentRound); + Membership membership = Membership.create(currentMember, recruitmentRound); membershipRepository.save(membership); log.info("[MembershipService] 멤버십 가입 신청 접수: membershipId = {}", membership.getId()); diff --git a/src/main/java/com/gdschongik/gdsc/domain/membership/domain/Membership.java b/src/main/java/com/gdschongik/gdsc/domain/membership/domain/Membership.java index 255f152cb..1dac952e2 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/membership/domain/Membership.java +++ b/src/main/java/com/gdschongik/gdsc/domain/membership/domain/Membership.java @@ -52,11 +52,11 @@ private Membership(Member member, RecruitmentRound recruitmentRound, RegularRequ this.regularRequirement = regularRequirement; } - public static Membership createMembership(Member member, RecruitmentRound recruitmentRound) { + public static Membership create(Member member, RecruitmentRound recruitmentRound) { return Membership.builder() .member(member) .recruitmentRound(recruitmentRound) - .regularRequirement(RegularRequirement.createUnsatisfiedRequirement()) + .regularRequirement(RegularRequirement.unsatisfied()) .build(); } diff --git a/src/main/java/com/gdschongik/gdsc/domain/membership/domain/RegularRequirement.java b/src/main/java/com/gdschongik/gdsc/domain/membership/domain/RegularRequirement.java index 9bc49ebeb..8698cd93f 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/membership/domain/RegularRequirement.java +++ b/src/main/java/com/gdschongik/gdsc/domain/membership/domain/RegularRequirement.java @@ -27,7 +27,7 @@ private RegularRequirement(RequirementStatus paymentStatus) { this.paymentStatus = paymentStatus; } - public static RegularRequirement createUnsatisfiedRequirement() { + public static RegularRequirement unsatisfied() { return RegularRequirement.builder() .paymentStatus(RequirementStatus.UNSATISFIED) .build(); diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentService.java b/src/main/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentService.java index 7eca3189f..8f6b2dbd6 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentService.java @@ -3,13 +3,13 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import com.gdschongik.gdsc.domain.common.vo.Money; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.recruitment.dao.RecruitmentRepository; import com.gdschongik.gdsc.domain.recruitment.dao.RecruitmentRoundRepository; import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRoundValidator; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentValidator; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.recruitment.dto.request.RecruitmentCreateRequest; import com.gdschongik.gdsc.domain.recruitment.dto.request.RecruitmentRoundCreateRequest; import com.gdschongik.gdsc.domain.recruitment.dto.request.RecruitmentRoundUpdateRequest; @@ -40,12 +40,12 @@ public void createRecruitment(RecruitmentCreateRequest request) { recruitmentValidator.validateRecruitmentCreate(isRecruitmentOverlap); - Recruitment recruitment = Recruitment.createRecruitment( + Recruitment recruitment = Recruitment.create( request.academicYear(), request.semesterType(), Money.from(request.fee()), request.feeName(), - Period.createPeriod(request.semesterStartDate(), request.semesterEndDate())); + Period.of(request.semesterStartDate(), request.semesterEndDate())); recruitmentRepository.save(recruitment); log.info("[AdminRecruitmentService] 리쿠르팅 생성: recruitmentId={}", recruitment.getId()); @@ -81,10 +81,7 @@ public void createRecruitmentRound(RecruitmentRoundCreateRequest request) { recruitmentRoundsInThisSemester); RecruitmentRound recruitmentRound = RecruitmentRound.create( - request.name(), - Period.createPeriod(request.startDate(), request.endDate()), - recruitment, - request.roundType()); + request.name(), Period.of(request.startDate(), request.endDate()), recruitment, request.roundType()); recruitmentRoundRepository.save(recruitmentRound); log.info("[AdminRecruitmentService] 모집회차 생성: recruitmentRoundId={}", recruitmentRound.getId()); @@ -106,7 +103,7 @@ public void updateRecruitmentRound(Long recruitmentRoundId, RecruitmentRoundUpda request.startDate(), request.endDate(), request.roundType(), recruitmentRound, recruitmentRounds); recruitmentRound.updateRecruitmentRound( - request.name(), Period.createPeriod(request.startDate(), request.endDate()), request.roundType()); + request.name(), Period.of(request.startDate(), request.endDate()), request.roundType()); log.info("[AdminRecruitmentService] 모집회차 수정: recruitmentRoundId={}", recruitmentRoundId); } diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/Recruitment.java b/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/Recruitment.java index 4626380bf..83d62f053 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/Recruitment.java +++ b/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/Recruitment.java @@ -3,7 +3,7 @@ import com.gdschongik.gdsc.domain.common.model.BaseSemesterEntity; import com.gdschongik.gdsc.domain.common.model.SemesterType; import com.gdschongik.gdsc.domain.common.vo.Money; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; @@ -37,7 +37,7 @@ private Recruitment( this.semesterPeriod = semesterPeriod; } - public static Recruitment createRecruitment( + public static Recruitment create( Integer academicYear, SemesterType semesterType, Money fee, String feeName, Period semesterPeriod) { return Recruitment.builder() .academicYear(academicYear) diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRound.java b/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRound.java index 59857f237..cfc772504 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRound.java +++ b/src/main/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRound.java @@ -4,7 +4,7 @@ import com.gdschongik.gdsc.domain.common.model.BaseSemesterEntity; import com.gdschongik.gdsc.domain.common.model.SemesterType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import jakarta.persistence.Column; import jakarta.persistence.Embedded; diff --git a/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/RecruitmentRoundFullDto.java b/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/RecruitmentRoundFullDto.java index 16af34cde..9189320a2 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/RecruitmentRoundFullDto.java +++ b/src/main/java/com/gdschongik/gdsc/domain/recruitment/dto/RecruitmentRoundFullDto.java @@ -1,8 +1,8 @@ package com.gdschongik.gdsc.domain.recruitment.dto; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; import com.gdschongik.gdsc.domain.recruitment.domain.RoundType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import java.math.BigDecimal; public record RecruitmentRoundFullDto( diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyService.java b/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyService.java index effc3df08..5a590107b 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/application/MentorStudyService.java @@ -122,8 +122,7 @@ public void createStudyAnnouncement(Long studyId, StudyAnnouncementCreateUpdateR studyValidator.validateStudyMentor(currentMember, study); - StudyAnnouncement studyAnnouncement = - StudyAnnouncement.createStudyAnnouncement(study, request.title(), request.link()); + StudyAnnouncement studyAnnouncement = StudyAnnouncement.create(study, request.title(), request.link()); studyAnnouncementRepository.save(studyAnnouncement); log.info("[MentorStudyService] 스터디 공지 생성: studyAnnouncementId={}", studyAnnouncement.getId()); diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyService.java b/src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyService.java index 7af5cccfb..f54bbcdce 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyService.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/application/StudentStudyService.java @@ -98,7 +98,7 @@ public void attend(Long studyDetailId, StudyAttendCreateRequest request) { attendanceValidator.validateAttendance( studyDetail, request.attendanceNumber(), LocalDate.now(), isAlreadyAttended, isAppliedToStudy); - Attendance attendance = Attendance.create(currentMember, studyDetail); + Attendance attendance = Attendance.of(currentMember, studyDetail); attendanceRepository.save(attendance); log.info("[StudyService] 스터디 출석: attendanceId={}, memberId={}", attendance.getId(), currentMember.getId()); diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/Attendance.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/Attendance.java index 7556fd8be..c8bbc7336 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/Attendance.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/Attendance.java @@ -42,7 +42,7 @@ private Attendance(Member student, StudyDetail studyDetail) { this.studyDetail = studyDetail; } - public static Attendance create(Member student, StudyDetail studyDetail) { + public static Attendance of(Member student, StudyDetail studyDetail) { return Attendance.builder().student(student).studyDetail(studyDetail).build(); } } diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java index 04856c315..a2137bf00 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/Study.java @@ -5,8 +5,8 @@ import com.gdschongik.gdsc.domain.common.model.BaseSemesterEntity; import com.gdschongik.gdsc.domain.common.model.SemesterType; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import jakarta.persistence.AttributeOverride; import jakarta.persistence.Column; @@ -102,7 +102,7 @@ private Study( this.endTime = endTime; } - public static Study createStudy( + public static Study create( Integer academicYear, SemesterType semesterType, String title, diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyAnnouncement.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyAnnouncement.java index f10470bc8..0e6a24dce 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyAnnouncement.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyAnnouncement.java @@ -40,7 +40,7 @@ public StudyAnnouncement(Study study, String title, String link) { this.link = link; } - public static StudyAnnouncement createStudyAnnouncement(Study study, String title, String link) { + public static StudyAnnouncement create(Study study, String title, String link) { return StudyAnnouncement.builder().study(study).title(title).link(link).build(); } diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java index c33a59d08..dde8d400f 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/StudyDetail.java @@ -3,7 +3,7 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import com.gdschongik.gdsc.domain.common.model.BaseEntity; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.study.domain.vo.Assignment; import com.gdschongik.gdsc.domain.study.domain.vo.Curriculum; import com.gdschongik.gdsc.global.exception.CustomException; @@ -71,28 +71,28 @@ private StudyDetail( this.assignment = assignment; } - public static StudyDetail createStudyDetail(Study study, Long week, String attendanceNumber, Period period) { + public static StudyDetail create(Study study, Long week, String attendanceNumber, Period period) { return StudyDetail.builder() .study(study) .week(week) .period(period) .attendanceNumber(attendanceNumber) .period(period) - .curriculum(Curriculum.createEmptyCurriculum()) - .assignment(Assignment.createEmptyAssignment()) + .curriculum(Curriculum.empty()) + .assignment(Assignment.empty()) .build(); } public void cancelAssignment() { - assignment = Assignment.cancelAssignment(); + assignment = Assignment.canceled(); } public void publishAssignment(String title, LocalDateTime deadLine, String descriptionNotionLink) { - assignment = Assignment.generateAssignment(title, deadLine, descriptionNotionLink); + assignment = Assignment.of(title, deadLine, descriptionNotionLink); } public void updateAssignment(String title, LocalDateTime deadLine, String descriptionNotionLink) { - assignment = Assignment.generateAssignment(title, deadLine, descriptionNotionLink); + assignment = Assignment.of(title, deadLine, descriptionNotionLink); } // 데이터 전달 로직 @@ -135,7 +135,7 @@ public boolean isAttendanceDayNotPassed(LocalDate now) { public void updateCurriculum( LocalTime startAt, String title, String description, Difficulty difficulty, StudyStatus status) { - curriculum = Curriculum.generateCurriculum(startAt, title, description, difficulty, status); + curriculum = Curriculum.of(startAt, title, description, difficulty, status); } public void validateAssignmentSubmittable(LocalDateTime now) { diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Assignment.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Assignment.java index 38be69b1f..ad503826b 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Assignment.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Assignment.java @@ -46,15 +46,7 @@ private Assignment(String title, LocalDateTime deadline, String descriptionLink, this.status = status; } - public static Assignment createEmptyAssignment() { - return Assignment.builder().status(NONE).build(); - } - - public static Assignment cancelAssignment() { - return Assignment.builder().status(CANCELLED).build(); - } - - public static Assignment generateAssignment(String title, LocalDateTime deadline, String descriptionLink) { + public static Assignment of(String title, LocalDateTime deadline, String descriptionLink) { return Assignment.builder() .title(title) .deadline(deadline) @@ -63,6 +55,14 @@ public static Assignment generateAssignment(String title, LocalDateTime deadline .build(); } + public static Assignment empty() { + return Assignment.builder().status(NONE).build(); + } + + public static Assignment canceled() { + return Assignment.builder().status(CANCELLED).build(); + } + public void validateSubmittable(LocalDateTime now) { if (status == NONE) { throw new CustomException(ASSIGNMENT_SUBMIT_NOT_PUBLISHED); @@ -98,6 +98,7 @@ public boolean isDeadlineRemaining() { public boolean isDeadLineThisWeek() { // 현재 날짜와 마감일의 날짜 부분을 비교할 것이므로 LocalDate로 변환 + // TODO: now를 내부에서 선언하지 않고 파라미터로 받아서 테스트 가능하도록 변경 LocalDate now = LocalDate.now(); LocalDate startOfWeek = now.with(DayOfWeek.MONDAY); // 이번 주 월요일 LocalDate endOfWeek = now.with(DayOfWeek.SUNDAY); // 이번 주 일요일 diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Curriculum.java b/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Curriculum.java index 0a982af34..b8e592a9f 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Curriculum.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/domain/vo/Curriculum.java @@ -41,11 +41,7 @@ private Curriculum(LocalTime startAt, String title, String description, Difficul this.status = status; } - public static Curriculum createEmptyCurriculum() { - return Curriculum.builder().status(StudyStatus.NONE).build(); - } - - public static Curriculum generateCurriculum( + public static Curriculum of( LocalTime startAt, String title, String description, Difficulty difficulty, StudyStatus status) { return Curriculum.builder() .startAt(startAt) @@ -56,6 +52,10 @@ public static Curriculum generateCurriculum( .build(); } + public static Curriculum empty() { + return Curriculum.builder().status(StudyStatus.NONE).build(); + } + // 데이터 전달 로직 public boolean isOpen() { return status == StudyStatus.OPEN; diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java index 096838a9d..14fd05c7a 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/CommonStudyResponse.java @@ -1,7 +1,7 @@ package com.gdschongik.gdsc.domain.study.dto.response; import com.gdschongik.gdsc.domain.common.model.SemesterType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.study.domain.Study; import io.swagger.v3.oas.annotations.media.Schema; import java.time.DayOfWeek; diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyCurriculumResponse.java b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyCurriculumResponse.java index 12f73f55b..c623ecc15 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyCurriculumResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyCurriculumResponse.java @@ -1,6 +1,6 @@ package com.gdschongik.gdsc.domain.study.dto.response; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.study.domain.Difficulty; import com.gdschongik.gdsc.domain.study.domain.StudyDetail; import com.gdschongik.gdsc.domain.study.domain.StudyStatus; diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyStudentCurriculumResponse.java b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyStudentCurriculumResponse.java index 0c6c84e0b..33e5b0530 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyStudentCurriculumResponse.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/dto/response/StudyStudentCurriculumResponse.java @@ -2,7 +2,7 @@ import static com.gdschongik.gdsc.domain.study.domain.SubmissionFailureType.NOT_SUBMITTED; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.study.domain.AssignmentHistory; import com.gdschongik.gdsc.domain.study.domain.Difficulty; import com.gdschongik.gdsc.domain.study.domain.StudyDetail; diff --git a/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java b/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java index a8a610410..bac2492c7 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java +++ b/src/main/java/com/gdschongik/gdsc/domain/study/factory/StudyDomainFactory.java @@ -1,7 +1,7 @@ package com.gdschongik.gdsc.domain.study.factory; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.domain.Study; import com.gdschongik.gdsc.domain.study.domain.StudyDetail; import com.gdschongik.gdsc.domain.study.dto.request.StudyCreateRequest; @@ -17,13 +17,13 @@ public class StudyDomainFactory { // 새로운 스터디를 생성합니다. public Study createNewStudy(StudyCreateRequest request, Member mentor) { LocalDate endDate = request.startDate().plusWeeks(request.totalWeek()).minusDays(1); - return Study.createStudy( + return Study.create( request.academicYear(), request.semesterType(), request.title(), mentor, - Period.createPeriod(request.startDate().atStartOfDay(), endDate.atTime(LocalTime.MAX)), - Period.createPeriod( + Period.of(request.startDate().atStartOfDay(), endDate.atTime(LocalTime.MAX)), + Period.of( request.applicationStartDate().atStartOfDay(), request.applicationEndDate().atTime(LocalTime.MAX)), request.totalWeek(), @@ -40,6 +40,6 @@ public StudyDetail createNoneStudyDetail(Study study, Long week) { String attendanceNumber = new Random().ints(4, 0, 10).mapToObj(String::valueOf).reduce("", String::concat); - return StudyDetail.createStudyDetail(study, week, attendanceNumber, Period.createPeriod(startDate, endDate)); + return StudyDetail.create(study, week, attendanceNumber, Period.of(startDate, endDate)); } } diff --git a/src/main/java/com/gdschongik/gdsc/global/security/CustomUserService.java b/src/main/java/com/gdschongik/gdsc/global/security/CustomUserService.java index 0edf0fed8..1472d2c46 100644 --- a/src/main/java/com/gdschongik/gdsc/global/security/CustomUserService.java +++ b/src/main/java/com/gdschongik/gdsc/global/security/CustomUserService.java @@ -1,7 +1,5 @@ package com.gdschongik.gdsc.global.security; -import static com.gdschongik.gdsc.global.common.constant.SecurityConstant.*; - import com.gdschongik.gdsc.domain.member.dao.MemberRepository; import com.gdschongik.gdsc.domain.member.domain.Member; import lombok.RequiredArgsConstructor; @@ -33,7 +31,7 @@ private Member fetchOrCreate(OAuth2User oAuth2User) { } private Member registerMember(OAuth2User oAuth2User) { - Member guest = Member.createGuestMember(oAuth2User.getName()); + Member guest = Member.createGuest(oAuth2User.getName()); return memberRepository.save(guest); } } diff --git a/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/CouponTest.java b/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/CouponTest.java index 72e2b8879..c61c15474 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/CouponTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/CouponTest.java @@ -18,7 +18,7 @@ class 쿠폰_생성할때 { @Test void 성공한다() { // when - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); // then assertThat(coupon).isNotNull(); @@ -30,7 +30,7 @@ class 쿠폰_생성할때 { Money discountAmount = Money.from(ZERO); // when & then - assertThatThrownBy(() -> Coupon.createCoupon(COUPON_NAME, discountAmount)) + assertThatThrownBy(() -> Coupon.create(COUPON_NAME, discountAmount)) .isInstanceOf(CustomException.class) .hasMessageContaining(COUPON_DISCOUNT_AMOUNT_NOT_POSITIVE.getMessage()); } diff --git a/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCouponTest.java b/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCouponTest.java index d5df0341f..b2887995e 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCouponTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/coupon/domain/IssuedCouponTest.java @@ -20,9 +20,9 @@ class 발급쿠폰_사용할때 { @Test void 성공하면_사용여부는_true이다() { // given - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); - Member member = Member.createGuestMember(OAUTH_ID); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); + Member member = Member.createGuest(OAUTH_ID); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); // when issuedCoupon.use(); @@ -34,9 +34,9 @@ class 발급쿠폰_사용할때 { @Test void 이미_사용한_쿠폰이면_실패한다() { // given - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); - Member member = Member.createGuestMember(OAUTH_ID); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); + Member member = Member.createGuest(OAUTH_ID); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); issuedCoupon.use(); // when & then @@ -48,9 +48,9 @@ class 발급쿠폰_사용할때 { @Test void 이미_회수한_쿠폰이면_실패한다() { // given - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); - Member member = Member.createGuestMember(OAUTH_ID); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); + Member member = Member.createGuest(OAUTH_ID); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); issuedCoupon.revoke(); // when & then @@ -66,9 +66,9 @@ class 발급쿠폰_회수할때 { @Test void 성공하면_회수여부는_true이다() { // given - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); - Member member = Member.createGuestMember(OAUTH_ID); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); + Member member = Member.createGuest(OAUTH_ID); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); // when issuedCoupon.revoke(); @@ -80,9 +80,9 @@ class 발급쿠폰_회수할때 { @Test void 이미_회수한_발급쿠폰이면_실패한다() { // given - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); - Member member = Member.createGuestMember(OAUTH_ID); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); + Member member = Member.createGuest(OAUTH_ID); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); issuedCoupon.revoke(); // when & then @@ -94,9 +94,9 @@ class 발급쿠폰_회수할때 { @Test void 이미_사용한_발급쿠폰이면_실패한다() { // given - Coupon coupon = Coupon.createCoupon(COUPON_NAME, Money.from(ONE)); - Member member = Member.createGuestMember(OAUTH_ID); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create(COUPON_NAME, Money.from(ONE)); + Member member = Member.createGuest(OAUTH_ID); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); issuedCoupon.use(); // when & then diff --git a/src/test/java/com/gdschongik/gdsc/domain/member/application/AdminMemberServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/member/application/AdminMemberServiceTest.java index 534c28729..2bb86d21d 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/member/application/AdminMemberServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/member/application/AdminMemberServiceTest.java @@ -24,7 +24,7 @@ class AdminMemberServiceTest extends IntegrationTest { @Test void status가_DELETED라면_예외_발생() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.withdraw(); memberRepository.save(member); diff --git a/src/test/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberServiceTest.java index 4438d08e3..112608f75 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/member/application/OnboardingMemberServiceTest.java @@ -4,12 +4,12 @@ import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.member.domain.MemberRole; import com.gdschongik.gdsc.domain.member.dto.response.MemberDashboardResponse; import com.gdschongik.gdsc.domain.recruitment.application.OnboardingRecruitmentService; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.helper.IntegrationTest; import java.util.Optional; import org.junit.jupiter.api.BeforeEach; @@ -52,7 +52,7 @@ void setUp() { @Test void 기본정보_미작성시_멤버_기본정보는_모두_null이다() { // given - memberRepository.save(Member.createGuestMember(OAUTH_ID)); + memberRepository.save(Member.createGuest(OAUTH_ID)); logoutAndReloginAs(1L, MemberRole.ASSOCIATE); // when diff --git a/src/test/java/com/gdschongik/gdsc/domain/member/dao/MemberRepositoryTest.java b/src/test/java/com/gdschongik/gdsc/domain/member/dao/MemberRepositoryTest.java index 61a25a03a..90e061be4 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/member/dao/MemberRepositoryTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/member/dao/MemberRepositoryTest.java @@ -27,7 +27,7 @@ class MemberRepositoryTest extends RepositoryTest { private MemberRepository memberRepository; private Member getMember() { - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); return memberRepository.save(member); } diff --git a/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberTest.java b/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberTest.java index 5904d96df..0cc6615bb 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberTest.java @@ -20,7 +20,7 @@ class 게스트_회원가입시 { @Test void MemberRole은_GUEST이다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when MemberRole role = member.getRole(); @@ -32,7 +32,7 @@ class 게스트_회원가입시 { @Test void MemberStatus는_NORMAL이다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when MemberStatus status = member.getStatus(); @@ -44,7 +44,7 @@ class 게스트_회원가입시 { @Test void 모든_준회원_가입조건은_인증되지_않은_상태이다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when AssociateRequirement requirement = member.getAssociateRequirement(); @@ -63,7 +63,7 @@ class 준회원_가입조건_인증시도시 { @Test void 기본회원정보_작성시_준회원_가입조건중_기본정보_인증상태가_인증된다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); @@ -76,7 +76,7 @@ class 준회원_가입조건_인증시도시 { @Test void 재학생이메일_인증시_준회원_가입조건중_재학생이메일_인증상태가_인증된다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when member.completeUnivEmailVerification(UNIV_EMAIL); @@ -89,7 +89,7 @@ class 준회원_가입조건_인증시도시 { @Test void 디스코드_인증시_준회원_가입조건중_디스코드_인증상태가_인증된다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when member.verifyDiscord(DISCORD_USERNAME, NICKNAME); @@ -102,7 +102,7 @@ class 준회원_가입조건_인증시도시 { @Test void Bevy_인증시_준회원_가입조건중_Bevy_인증상태가_인증된다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when member.verifyBevy(); @@ -119,7 +119,7 @@ class 준회원으로_승급시도시 { @Test void 기본_회원정보_작성하지_않았으면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.verifyDiscord(DISCORD_USERNAME, NICKNAME); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -134,7 +134,7 @@ class 준회원으로_승급시도시 { @Test void 디스코드_인증하지_않았으면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -149,7 +149,7 @@ class 준회원으로_승급시도시 { @Test void Bevy_연동하지_않았으면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -164,7 +164,7 @@ class 준회원으로_승급시도시 { @Test void 이미_준회원으로_승급_돼있으면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -181,7 +181,7 @@ class 준회원으로_승급시도시 { @Test void 모든_준회원_가입조건이_인증되었으면_성공한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -202,7 +202,7 @@ class 회원탈퇴시 { @Test void 이미_탈퇴한_유저면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.withdraw(); @@ -215,7 +215,7 @@ class 회원탈퇴시 { @Test void 회원탈퇴시_이전에_탈퇴하지_않은_유저면_성공한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when member.withdraw(); @@ -230,7 +230,7 @@ class 회원수정시 { @Test void 탈퇴하지_않은_유저면_성공한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateMemberInfo( MODIFIED_STUDENT_ID, NAME, PHONE_NUMBER, D022, UNIV_EMAIL, DISCORD_USERNAME, NICKNAME); @@ -242,7 +242,7 @@ class 회원수정시 { @Test void 탈퇴한_유저면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.withdraw(); @@ -259,7 +259,7 @@ class 회원수정시 { @Test void 디스코드인증시_탈퇴한_유저면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.withdraw(); @@ -274,7 +274,7 @@ class 회원수정시 { @Test void Bevy인증시_탈퇴한_유저면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.withdraw(); @@ -289,7 +289,7 @@ class 정회원으로_승급_시도시 { @Test void 이미_정회원이라면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -307,7 +307,7 @@ class 정회원으로_승급_시도시 { @Test void MemberRole이_GUEST_이라면_실패한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); // when & then assertThatThrownBy(member::advanceToRegular) @@ -318,7 +318,7 @@ class 정회원으로_승급_시도시 { @Test void 준회원이라면_성공한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -340,7 +340,7 @@ class 비회원으로_강등시 { @Test void 성공한다() { // given - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); diff --git a/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberValidatorTest.java index 82a70e15a..f4b4dee4d 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/member/domain/MemberValidatorTest.java @@ -5,9 +5,9 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import java.time.LocalDateTime; import java.util.List; @@ -25,13 +25,10 @@ class 준회원으로_일괄_강등시 { void 해당_학기에_이미_시작된_모집기간이_있다면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); LocalDateTime now = LocalDateTime.now(); RecruitmentRound recruitmentRound = RecruitmentRound.create( - RECRUITMENT_ROUND_NAME, - Period.createPeriod(now.minusDays(1), now.plusDays(1)), - recruitment, - ROUND_TYPE); + RECRUITMENT_ROUND_NAME, Period.of(now.minusDays(1), now.plusDays(1)), recruitment, ROUND_TYPE); List recruitmentRounds = List.of(recruitmentRound); // when & then diff --git a/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipTest.java b/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipTest.java index 72d015e43..bcbfe0a96 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipTest.java @@ -7,10 +7,10 @@ import static com.gdschongik.gdsc.global.common.constant.TemporalConstant.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -22,24 +22,20 @@ class 멤버십_가입신청시 { @Test void 성공한다() { // given - Member member = createGuestMember(OAUTH_ID); + Member member = createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); member.verifyDiscord(DISCORD_USERNAME, NICKNAME); member.verifyBevy(); member.advanceToAssociate(); - Recruitment recruitment = Recruitment.createRecruitment( - ACADEMIC_YEAR, - SEMESTER_TYPE, - FEE, - FEE_NAME, - Period.createPeriod(SEMESTER_START_DATE, SEMESTER_END_DATE)); + Recruitment recruitment = Recruitment.create( + ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, Period.of(SEMESTER_START_DATE, SEMESTER_END_DATE)); RecruitmentRound recruitmentRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); // when - Membership membership = Membership.createMembership(member, recruitmentRound); + Membership membership = Membership.create(member, recruitmentRound); // then assertThat(membership).isNotNull(); diff --git a/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipValidatorTest.java index cb99e27ec..eb8495117 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/membership/domain/MembershipValidatorTest.java @@ -10,10 +10,10 @@ import com.gdschongik.gdsc.domain.common.model.SemesterType; import com.gdschongik.gdsc.domain.common.vo.Money; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import java.time.LocalDateTime; import org.junit.jupiter.api.Nested; @@ -25,7 +25,7 @@ class MembershipValidatorTest { MembershipValidator membershipValidator = new MembershipValidator(); private Member createAssociateMember(Long id) { - Member member = createGuestMember(OAUTH_ID); + Member member = createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); member.verifyDiscord(DISCORD_USERNAME, NICKNAME); @@ -41,10 +41,9 @@ private RecruitmentRound createRecruitmentRound( Money fee, LocalDateTime startDate, LocalDateTime endDate) { - Recruitment recruitment = Recruitment.createRecruitment( - academicYear, semesterType, fee, FEE_NAME, Period.createPeriod(SEMESTER_START_DATE, SEMESTER_END_DATE)); - return RecruitmentRound.create( - RECRUITMENT_ROUND_NAME, Period.createPeriod(startDate, endDate), recruitment, ROUND_TYPE); + Recruitment recruitment = Recruitment.create( + academicYear, semesterType, fee, FEE_NAME, Period.of(SEMESTER_START_DATE, SEMESTER_END_DATE)); + return RecruitmentRound.create(RECRUITMENT_ROUND_NAME, Period.of(startDate, endDate), recruitment, ROUND_TYPE); } @Nested @@ -53,7 +52,7 @@ class 멤버십_가입신청시 { @Test void 역할이_GUEST라면_멤버십_가입신청에_실패한다() { // given - Member member = createGuestMember(OAUTH_ID); + Member member = createGuest(OAUTH_ID); RecruitmentRound recruitmentRound = createRecruitmentRound(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, START_DATE, END_DATE); @@ -86,7 +85,7 @@ class 멤버십_가입신청시 { RecruitmentRound recruitmentRound = createRecruitmentRound(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, START_DATE, END_DATE); - Membership membership = Membership.createMembership(member, recruitmentRound); + Membership membership = Membership.create(member, recruitmentRound); // when & then assertThatThrownBy(() -> membershipValidator.validateMembershipSubmit(member, recruitmentRound, true)) diff --git a/src/test/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentServiceTest.java index 805828841..8225bf2aa 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/recruitment/application/AdminRecruitmentServiceTest.java @@ -5,11 +5,11 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.recruitment.dao.RecruitmentRepository; import com.gdschongik.gdsc.domain.recruitment.dao.RecruitmentRoundRepository; import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.recruitment.dto.request.RecruitmentCreateRequest; import com.gdschongik.gdsc.domain.recruitment.dto.request.RecruitmentRoundCreateRequest; import com.gdschongik.gdsc.domain.recruitment.dto.request.RecruitmentRoundUpdateRequest; @@ -70,15 +70,12 @@ class 모집회차_수정시 { void 성공한다() { // given LocalDateTime now = LocalDateTime.now().withNano(0); - Recruitment recruitment = Recruitment.createRecruitment( - ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, Period.createPeriod(now, now.plusMonths(3))); + Recruitment recruitment = + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, Period.of(now, now.plusMonths(3))); recruitmentRepository.save(recruitment); RecruitmentRound recruitmentRound = RecruitmentRound.create( - RECRUITMENT_ROUND_NAME, - Period.createPeriod(now.plusDays(1), now.plusDays(2)), - recruitment, - ROUND_TYPE); + RECRUITMENT_ROUND_NAME, Period.of(now.plusDays(1), now.plusDays(2)), recruitment, ROUND_TYPE); recruitmentRoundRepository.save(recruitmentRound); RecruitmentRoundUpdateRequest request = new RecruitmentRoundUpdateRequest( diff --git a/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/PeriodTest.java b/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/PeriodTest.java index 02e3f65b6..9375f49ba 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/PeriodTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/PeriodTest.java @@ -5,7 +5,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -17,7 +17,7 @@ class Period생성시 { @Test void 시작일이_종료일보다_앞서면_성공한다() { // when - Period period = Period.createPeriod(START_DATE, END_DATE); + Period period = Period.of(START_DATE, END_DATE); // then assertThat(period.getStartDate()).isEqualTo(START_DATE); @@ -28,7 +28,7 @@ class Period생성시 { void 종료일이_시작일보다_앞서면_실패한다() { // when & then assertThatThrownBy(() -> { - Period.createPeriod(END_DATE, START_DATE); + Period.of(END_DATE, START_DATE); }) .isInstanceOf(CustomException.class) .hasMessage(DATE_PRECEDENCE_INVALID.getMessage()); @@ -38,7 +38,7 @@ class Period생성시 { void 종료일이_시작일과_같으면_실패한다() { // when & then assertThatThrownBy(() -> { - Period.createPeriod(START_DATE, WRONG_END_DATE); + Period.of(START_DATE, WRONG_END_DATE); }) .isInstanceOf(CustomException.class) .hasMessage(DATE_PRECEDENCE_INVALID.getMessage()); diff --git a/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRoundValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRoundValidatorTest.java index 20b250d15..72e34ec91 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRoundValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentRoundValidatorTest.java @@ -6,7 +6,7 @@ import static org.assertj.core.api.Assertions.*; import com.gdschongik.gdsc.domain.common.model.SemesterType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import java.time.LocalDateTime; import java.util.List; @@ -24,12 +24,12 @@ class 모집회차_생성시 { @Test void 모집_시작일과_종료일의_연도가_입력된_학년도와_다르다면_실패한다() { // given - Recruitment recruitment = Recruitment.createRecruitment( + Recruitment recruitment = Recruitment.create( 2025, SEMESTER_TYPE, FEE, FEE_NAME, - Period.createPeriod(LocalDateTime.of(2025, 3, 2, 0, 0), LocalDateTime.of(2025, 8, 31, 0, 0))); + Period.of(LocalDateTime.of(2025, 3, 2, 0, 0), LocalDateTime.of(2025, 8, 31, 0, 0))); // when & then assertThatThrownBy(() -> recruitmentRoundValidator.validateRecruitmentRoundCreate( @@ -41,12 +41,12 @@ class 모집회차_생성시 { @Test void 학기_시작일과_종료일의_학기가_입력된_학기와_다르다면_실패한다() { // given - Recruitment recruitment = Recruitment.createRecruitment( + Recruitment recruitment = Recruitment.create( ACADEMIC_YEAR, SemesterType.SECOND, FEE, FEE_NAME, - Period.createPeriod(LocalDateTime.of(2024, 9, 1, 0, 0), LocalDateTime.of(2025, 2, 28, 0, 0))); + Period.of(LocalDateTime.of(2024, 9, 1, 0, 0), LocalDateTime.of(2025, 2, 28, 0, 0))); // when & then assertThatThrownBy(() -> recruitmentRoundValidator.validateRecruitmentRoundCreate( @@ -59,7 +59,7 @@ class 모집회차_생성시 { void 모집_시작일과_종료일이_학기_시작일로부터_2주_이내에_있지_않다면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); // when & then assertThatThrownBy(() -> recruitmentRoundValidator.validateRecruitmentRoundCreate( @@ -72,7 +72,7 @@ class 모집회차_생성시 { void 학년도_학기_차수가_모두_중복되면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound recruitmentRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); @@ -92,7 +92,7 @@ class 모집회차_생성시 { void RoundType_1차가_없을때_2차를_생성하려_하면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); // when & then assertThatThrownBy(() -> recruitmentRoundValidator.validateRecruitmentRoundCreate( @@ -105,7 +105,7 @@ class 모집회차_생성시 { void 기간이_중복되는_모집회차가_있다면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound recruitmentRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); @@ -125,7 +125,7 @@ class 모집회차_수정시 { void 기간이_중복되는_모집회차가_있다면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound firstRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); @@ -146,7 +146,7 @@ class 모집회차_수정시 { void 차수가_중복되는_모집회차가_있다면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound firstRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); @@ -167,7 +167,7 @@ class 모집회차_수정시 { void 모집_시작일과_종료일이_학기_시작일로부터_2주_이내에_있지_않다면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound firstRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); @@ -184,7 +184,7 @@ class 모집회차_수정시 { void RoundType_1차를_2차로_수정하려_하면_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound firstRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); @@ -201,7 +201,7 @@ class 모집회차_수정시 { void 모집_시작일이_지났다면_수정_실패한다() { // given Recruitment recruitment = - Recruitment.createRecruitment(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); + Recruitment.create(ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, START_TO_END_PERIOD); RecruitmentRound recruitmentRound = RecruitmentRound.create(RECRUITMENT_ROUND_NAME, START_TO_END_PERIOD, recruitment, ROUND_TYPE); diff --git a/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentTest.java b/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentTest.java index b8f28b26e..b131ef500 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/recruitment/domain/RecruitmentTest.java @@ -4,7 +4,7 @@ import static com.gdschongik.gdsc.global.common.constant.TemporalConstant.*; import static org.assertj.core.api.Assertions.*; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -15,15 +15,11 @@ class 학기생성시 { @Test void Period가_제대로_생성된다() { // given - Period period = Period.createPeriod(SEMESTER_START_DATE, SEMESTER_END_DATE); + Period period = Period.of(SEMESTER_START_DATE, SEMESTER_END_DATE); // when - Recruitment recruitment = Recruitment.createRecruitment( - ACADEMIC_YEAR, - SEMESTER_TYPE, - FEE, - FEE_NAME, - Period.createPeriod(SEMESTER_START_DATE, SEMESTER_END_DATE)); + Recruitment recruitment = Recruitment.create( + ACADEMIC_YEAR, SEMESTER_TYPE, FEE, FEE_NAME, Period.of(SEMESTER_START_DATE, SEMESTER_END_DATE)); // then assertThat(recruitment.getSemesterPeriod().getStartDate()).isEqualTo(SEMESTER_START_DATE); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyAchievementServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyAchievementServiceTest.java index 6fea5b242..e75ab5527 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyAchievementServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyAchievementServiceTest.java @@ -3,8 +3,8 @@ import static com.gdschongik.gdsc.domain.study.domain.AchievementType.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.domain.Study; import com.gdschongik.gdsc.domain.study.domain.StudyAchievement; import com.gdschongik.gdsc.domain.study.dto.request.OutstandingStudentRequest; @@ -28,10 +28,8 @@ class 우수_스터디원_지정시 { // given LocalDateTime now = LocalDateTime.now(); Member mentor = createMentor(); - Study study = createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + Study study = + createStudy(mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); Member student = createRegularMember(); createStudyHistory(student, study); @@ -59,10 +57,8 @@ class 우수_스터디원_철회시 { Member student = createRegularMember(); LocalDateTime now = LocalDateTime.now(); Member mentor = createMentor(); - Study study = createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + Study study = + createStudy(mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); createStudyHistory(student, study); createStudyAchievement(student, study, FIRST_ROUND_OUTSTANDING_STUDENT); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailServiceTest.java index f428d04c7..190b508c6 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyDetailServiceTest.java @@ -2,9 +2,9 @@ import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.member.domain.MemberRole; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.dao.StudyDetailRepository; import com.gdschongik.gdsc.domain.study.domain.Study; import com.gdschongik.gdsc.domain.study.domain.StudyDetail; @@ -31,10 +31,8 @@ class 스터디_과제_휴강_처리시 { // given LocalDateTime now = LocalDateTime.now(); Member mentor = createAssociateMember(); - Study study = createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + Study study = + createStudy(mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = createStudyDetail(study, now, now.plusDays(7)); logoutAndReloginAs(studyDetail.getStudy().getMentor().getId(), MemberRole.ASSOCIATE); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyServiceTest.java index 6e188a09a..3232a73c8 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/application/MentorStudyServiceTest.java @@ -3,9 +3,9 @@ import static com.gdschongik.gdsc.global.common.constant.StudyConstant.*; import static org.assertj.core.api.Assertions.assertThat; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.member.domain.MemberRole; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.domain.Difficulty; import com.gdschongik.gdsc.domain.study.domain.Study; import com.gdschongik.gdsc.domain.study.domain.StudyDetail; @@ -32,10 +32,7 @@ class 스터디_정보_작성시 { LocalDateTime now = STUDY_START_DATETIME; Member mentor = createMentor(); Study study = createNewStudy( - mentor, - 4L, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, 4L, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); for (int i = 1; i <= 4; i++) { Long week = (long) i; createNewStudyDetail(week, study, now, now.plusDays(7)); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryServiceTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryServiceTest.java index 9aa0ad9ca..fe37b2b82 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryServiceTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/application/StudentStudyHistoryServiceTest.java @@ -4,9 +4,9 @@ import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; import com.gdschongik.gdsc.domain.member.domain.MemberRole; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.dao.AssignmentHistoryRepository; import com.gdschongik.gdsc.domain.study.dao.StudyHistoryRepository; import com.gdschongik.gdsc.domain.study.domain.AssignmentHistory; @@ -52,8 +52,8 @@ class 과제_제출할때 { LocalDateTime now = LocalDateTime.now(); // 통합 테스트에서는 LocalDateTime.now()를 사용해야 함 Study study = createStudy( mentor, - Period.createPeriod(now.minusWeeks(1), now.plusWeeks(7)), // 스터디 기간: 1주 전 ~ 7주 후 - Period.createPeriod(now.minusWeeks(2), now.minusWeeks(1))); // 수강신청 기간: 2주 전 ~ 1주 전 + Period.of(now.minusWeeks(1), now.plusWeeks(7)), // 스터디 기간: 1주 전 ~ 7주 후 + Period.of(now.minusWeeks(2), now.minusWeeks(1))); // 수강신청 기간: 2주 전 ~ 1주 전 StudyDetail studyDetail = createStudyDetail(study, now.minusDays(6), now.plusDays(1)); // 1주차 기간: 6일 전 ~ 1일 후 publishAssignment(studyDetail); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryGraderTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryGraderTest.java index 2f004cc66..00d6cb2dd 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryGraderTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryGraderTest.java @@ -4,7 +4,7 @@ import static org.assertj.core.api.Assertions.*; import static org.mockito.Mockito.*; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.global.exception.ErrorCode; import com.gdschongik.gdsc.helper.FixtureHelper; @@ -28,8 +28,7 @@ private AssignmentHistory createAssignmentHistory() { } private Study createStudyWithMentor(Long mentorId) { - Period applicationPeriod = - Period.createPeriod(STUDY_START_DATETIME.minusDays(7), STUDY_START_DATETIME.minusDays(1)); + Period applicationPeriod = Period.of(STUDY_START_DATETIME.minusDays(7), STUDY_START_DATETIME.minusDays(1)); return fixtureHelper.createStudyWithMentor(mentorId, STUDY_ONGOING_PERIOD, applicationPeriod); } diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryTest.java index 689852f10..bda85e54f 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/AssignmentHistoryTest.java @@ -4,8 +4,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.helper.FixtureHelper; import org.junit.jupiter.api.Nested; @@ -20,8 +20,7 @@ private Member createMember(Long id) { } private Study createStudyWithMentor(Long mentorId) { - Period applicationPeriod = - Period.createPeriod(STUDY_START_DATETIME.minusDays(7), STUDY_START_DATETIME.minusDays(1)); + Period applicationPeriod = Period.of(STUDY_START_DATETIME.minusDays(7), STUDY_START_DATETIME.minusDays(1)); return fixtureHelper.createStudyWithMentor(mentorId, STUDY_ONGOING_PERIOD, applicationPeriod); } diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/AttendanceValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/AttendanceValidatorTest.java index f66643223..685b51bbb 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/AttendanceValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/AttendanceValidatorTest.java @@ -4,8 +4,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.helper.FixtureHelper; import java.time.LocalDate; @@ -27,8 +27,8 @@ class 스터디_출석체크시 { Member student = fixtureHelper.createRegularMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(65)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.plusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(65)); + Period applicationPeriod = Period.of(now.minusDays(10), now.plusDays(5)); Study study = fixtureHelper.createStudy(student, period, applicationPeriod); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); @@ -47,8 +47,8 @@ class 스터디_출석체크시 { Member student = fixtureHelper.createRegularMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(65)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.plusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(65)); + Period applicationPeriod = Period.of(now.minusDays(10), now.plusDays(5)); Study study = fixtureHelper.createStudy(student, period, applicationPeriod); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); @@ -67,8 +67,8 @@ class 스터디_출석체크시 { Member student = fixtureHelper.createRegularMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(65)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.plusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(65)); + Period applicationPeriod = Period.of(now.minusDays(10), now.plusDays(5)); Study study = fixtureHelper.createStudy(student, period, applicationPeriod); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); @@ -87,8 +87,8 @@ class 스터디_출석체크시 { Member student = fixtureHelper.createRegularMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(65)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.plusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(65)); + Period applicationPeriod = Period.of(now.minusDays(10), now.plusDays(5)); Study study = fixtureHelper.createStudy(student, period, applicationPeriod); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyAssignmentHistoryValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyAssignmentHistoryValidatorTest.java index c2fae7e91..09c0fd4f0 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyAssignmentHistoryValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyAssignmentHistoryValidatorTest.java @@ -4,8 +4,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.helper.FixtureHelper; import java.time.LocalDateTime; @@ -23,8 +23,7 @@ private Member createMember(Long id) { } private Study createStudyWithMentor(Long mentorId) { - Period applicationPeriod = - Period.createPeriod(STUDY_START_DATETIME.minusDays(7), STUDY_START_DATETIME.minusDays(1)); + Period applicationPeriod = Period.of(STUDY_START_DATETIME.minusDays(7), STUDY_START_DATETIME.minusDays(1)); return fixtureHelper.createStudyWithMentor(mentorId, STUDY_ONGOING_PERIOD, applicationPeriod); } diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java index b4bd8023c..a0519795b 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailTest.java @@ -3,8 +3,8 @@ import static com.gdschongik.gdsc.global.common.constant.StudyConstant.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.helper.FixtureHelper; import java.time.LocalDateTime; import org.junit.jupiter.api.Nested; @@ -22,9 +22,7 @@ class 과제_휴강_처리시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); // when @@ -44,9 +42,7 @@ class 과제_개설시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); // when diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidatorTest.java index 2b7e3285f..b6218ac76 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyDetailValidatorTest.java @@ -4,8 +4,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.dto.request.AssignmentCreateUpdateRequest; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.helper.FixtureHelper; @@ -30,9 +30,7 @@ class 과제_휴강_처리시 { LocalDateTime now = LocalDateTime.now(); Member mentor = fixtureHelper.createAssociateMember(1L); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); Member anotherMember = fixtureHelper.createAssociateMember(2L); @@ -52,9 +50,7 @@ class 과제_개설시 { LocalDateTime now = LocalDateTime.now(); Member mentor = fixtureHelper.createAssociateMember(1L); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); Member anotherMember = fixtureHelper.createAssociateMember(2L); AssignmentCreateUpdateRequest request = @@ -73,9 +69,7 @@ class 과제_개설시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(7)); AssignmentCreateUpdateRequest request = new AssignmentCreateUpdateRequest(ASSIGNMENT_TITLE, DESCRIPTION_LINK, now.minusDays(2)); @@ -96,9 +90,7 @@ class 과제_수정시 { LocalDateTime now = LocalDateTime.now(); Member mentor = fixtureHelper.createAssociateMember(1L); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(10)); Member anotherMember = fixtureHelper.createAssociateMember(2L); @@ -121,8 +113,8 @@ class 과제_수정시 { LocalDateTime assignmentCreatedDate = LocalDateTime.now().minusDays(1); Study study = fixtureHelper.createStudy( mentor, - Period.createPeriod(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), - Period.createPeriod(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); + Period.of(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), + Period.of(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, assignmentCreatedDate, assignmentCreatedDate.plusDays(1)); studyDetail.publishAssignment(ASSIGNMENT_TITLE, assignmentCreatedDate.plusDays(1), DESCRIPTION_LINK); @@ -143,9 +135,7 @@ class 과제_수정시 { LocalDateTime now = LocalDateTime.now(); Member mentor = fixtureHelper.createAssociateMember(1L); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyDetail studyDetail = fixtureHelper.createStudyDetail(study, now, now.plusDays(10)); LocalDateTime savedDeadLine = now.minusDays(1); studyDetail.publishAssignment(ASSIGNMENT_TITLE, savedDeadLine, DESCRIPTION_LINK); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryTest.java index 104d75bb5..d1af51efe 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryTest.java @@ -3,8 +3,8 @@ import static com.gdschongik.gdsc.domain.study.domain.StudyHistoryStatus.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.helper.FixtureHelper; import java.time.LocalDateTime; import org.junit.jupiter.api.Nested; @@ -24,9 +24,7 @@ class 스터디_히스토리_생성시 { Member mentor = fixtureHelper.createRegularMember(2L); LocalDateTime now = LocalDateTime.now(); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); // when StudyHistory studyHistory = StudyHistory.create(student, study); @@ -46,9 +44,7 @@ class 스터디_수료시 { Member mentor = fixtureHelper.createRegularMember(2L); LocalDateTime now = LocalDateTime.now(); Study study = fixtureHelper.createStudy( - mentor, - Period.createPeriod(now.plusDays(5), now.plusDays(10)), - Period.createPeriod(now.minusDays(5), now)); + mentor, Period.of(now.plusDays(5), now.plusDays(10)), Period.of(now.minusDays(5), now)); StudyHistory studyHistory = StudyHistory.create(student, study); diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryValidatorTest.java index 7ddc02778..d4977f081 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryValidatorTest.java @@ -4,8 +4,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.helper.FixtureHelper; import java.time.LocalDateTime; @@ -27,8 +27,8 @@ class 스터디_수강신청시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(15)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.plusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(15)); + Period applicationPeriod = Period.of(now.minusDays(10), now.plusDays(5)); Study study = fixtureHelper.createStudy(mentor, period, applicationPeriod); Member student = fixtureHelper.createGuestMember(2L); @@ -46,8 +46,8 @@ class 스터디_수강신청시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(15)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.minusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(15)); + Period applicationPeriod = Period.of(now.minusDays(10), now.minusDays(5)); Study study = fixtureHelper.createStudy(mentor, period, applicationPeriod); // when & then @@ -62,8 +62,8 @@ class 스터디_수강신청시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.minusDays(5), now.plusDays(15)); - Period applicationPeriod = Period.createPeriod(now.minusDays(15), now.plusDays(5)); + Period period = Period.of(now.minusDays(5), now.plusDays(15)); + Period applicationPeriod = Period.of(now.minusDays(15), now.plusDays(5)); Study study = fixtureHelper.createStudy(mentor, period, applicationPeriod); Study anotherStudy = fixtureHelper.createStudy(mentor, period, applicationPeriod); @@ -87,8 +87,8 @@ class 스터디_수강신청_취소시 { Member mentor = fixtureHelper.createAssociateMember(1L); LocalDateTime now = LocalDateTime.now(); - Period period = Period.createPeriod(now.plusDays(10), now.plusDays(15)); - Period applicationPeriod = Period.createPeriod(now.minusDays(10), now.minusDays(5)); + Period period = Period.of(now.plusDays(10), now.plusDays(15)); + Period applicationPeriod = Period.of(now.minusDays(10), now.minusDays(5)); Study study = fixtureHelper.createStudy(mentor, period, applicationPeriod); // when & then diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java index 0d04fa356..4ad001fed 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyTest.java @@ -1,7 +1,7 @@ package com.gdschongik.gdsc.domain.study.domain; import static com.gdschongik.gdsc.domain.member.domain.Department.D022; -import static com.gdschongik.gdsc.domain.member.domain.Member.createGuestMember; +import static com.gdschongik.gdsc.domain.member.domain.Member.createGuest; import static com.gdschongik.gdsc.global.common.constant.MemberConstant.*; import static com.gdschongik.gdsc.global.common.constant.RecruitmentConstant.*; import static com.gdschongik.gdsc.global.common.constant.StudyConstant.*; @@ -9,8 +9,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import java.time.LocalTime; import org.junit.jupiter.api.Nested; @@ -20,7 +20,7 @@ public class StudyTest { private Member createAssociateMember(Long id) { - Member member = createGuestMember(OAUTH_ID); + Member member = createGuest(OAUTH_ID); member.updateBasicMemberInfo(STUDENT_ID, NAME, PHONE_NUMBER, D022, EMAIL); member.completeUnivEmailVerification(UNIV_EMAIL); member.verifyDiscord(DISCORD_USERNAME, NICKNAME); @@ -36,11 +36,11 @@ class 스터디_개설시 { @Test void 게스트인_회원을_멘토로_지정하면_실패한다() { // given - Member guestMember = Member.createGuestMember(OAUTH_ID); - Period applicationPeriod = Period.createPeriod(START_DATE.minusDays(10), START_DATE.minusDays(5)); + Member guestMember = Member.createGuest(OAUTH_ID); + Period applicationPeriod = Period.of(START_DATE.minusDays(10), START_DATE.minusDays(5)); // when & then - assertThatThrownBy(() -> Study.createStudy( + assertThatThrownBy(() -> Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -60,11 +60,11 @@ class 스터디_개설시 { void 신청기간_시작일이_스터디_시작일보다_늦으면_실패한다() { // given Member member = createAssociateMember(1L); - Period period = Period.createPeriod(START_DATE, END_DATE); - Period applicationPeriod = Period.createPeriod(START_DATE.plusDays(1), START_DATE.plusDays(2)); + Period period = Period.of(START_DATE, END_DATE); + Period applicationPeriod = Period.of(START_DATE.plusDays(1), START_DATE.plusDays(2)); // when & then - assertThatThrownBy(() -> Study.createStudy( + assertThatThrownBy(() -> Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -84,11 +84,11 @@ class 스터디_개설시 { void 온오프라인_스터디에_스터디_시각이_없으면_실패한다() { // given Member member = createAssociateMember(1L); - Period period = Period.createPeriod(START_DATE, END_DATE); - Period applicationPeriod = Period.createPeriod(START_DATE.minusDays(5), START_DATE.plusDays(3)); + Period period = Period.of(START_DATE, END_DATE); + Period applicationPeriod = Period.of(START_DATE.minusDays(5), START_DATE.plusDays(3)); // when & then - assertThatThrownBy(() -> Study.createStudy( + assertThatThrownBy(() -> Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -108,13 +108,13 @@ class 스터디_개설시 { void 온오프라인_스터디에_스터디_시작시각이_종료시각보다_늦으면_실패한다() { // given Member member = createAssociateMember(1L); - Period period = Period.createPeriod(START_DATE, END_DATE); - Period applicationPeriod = Period.createPeriod(START_DATE.minusDays(5), START_DATE.plusDays(3)); + Period period = Period.of(START_DATE, END_DATE); + Period applicationPeriod = Period.of(START_DATE.minusDays(5), START_DATE.plusDays(3)); LocalTime studyStartTime = STUDY_START_TIME; LocalTime studyEndTime = STUDY_START_TIME.minusHours(2); // when & then - assertThatThrownBy(() -> Study.createStudy( + assertThatThrownBy(() -> Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -134,13 +134,13 @@ class 스터디_개설시 { void 과제_스터디에_스터디_시각이_있으면_실패한다() { // given Member member = createAssociateMember(1L); - Period period = Period.createPeriod(START_DATE, END_DATE); - Period applicationPeriod = Period.createPeriod(START_DATE.minusDays(5), START_DATE.plusDays(3)); + Period period = Period.of(START_DATE, END_DATE); + Period applicationPeriod = Period.of(START_DATE.minusDays(5), START_DATE.plusDays(3)); LocalTime studyStartTime = STUDY_START_TIME; LocalTime studyEndTime = STUDY_END_TIME; // when & then - assertThatThrownBy(() -> Study.createStudy( + assertThatThrownBy(() -> Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, diff --git a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyValidatorTest.java b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyValidatorTest.java index 3a65e77b1..66f84e856 100644 --- a/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyValidatorTest.java +++ b/src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyValidatorTest.java @@ -3,8 +3,8 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import static org.assertj.core.api.Assertions.*; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.member.domain.Member; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.global.exception.CustomException; import com.gdschongik.gdsc.helper.FixtureHelper; import java.time.LocalDateTime; @@ -40,8 +40,8 @@ class 스터디_멘토역할_검증시 { LocalDateTime assignmentCreatedDate = LocalDateTime.now().minusDays(1); Study study = fixtureHelper.createStudy( mentor, - Period.createPeriod(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), - Period.createPeriod(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); + Period.of(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), + Period.of(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); // when & then assertThatThrownBy(() -> studyValidator.validateStudyMentor(currentMember, study)) @@ -57,13 +57,13 @@ class 스터디_멘토역할_검증시 { LocalDateTime assignmentCreatedDate = LocalDateTime.now().minusDays(1); Study study = fixtureHelper.createStudy( mentor, - Period.createPeriod(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), - Period.createPeriod(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); + Period.of(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), + Period.of(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); Study currentMentorStudy = fixtureHelper.createStudy( currentMember, - Period.createPeriod(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), - Period.createPeriod(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); + Period.of(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), + Period.of(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); // when & then assertThat(currentMentorStudy.getMentor().getId()).isEqualTo(currentMember.getId()); @@ -80,8 +80,8 @@ class 스터디_멘토역할_검증시 { LocalDateTime assignmentCreatedDate = LocalDateTime.now().minusDays(1); Study study = fixtureHelper.createStudy( mentor, - Period.createPeriod(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), - Period.createPeriod(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); + Period.of(assignmentCreatedDate.plusDays(5), assignmentCreatedDate.plusDays(10)), + Period.of(assignmentCreatedDate.minusDays(5), assignmentCreatedDate)); // when & then assertThatCode(() -> studyValidator.validateStudyMentor(admin, study)) diff --git a/src/test/java/com/gdschongik/gdsc/global/common/constant/RecruitmentConstant.java b/src/test/java/com/gdschongik/gdsc/global/common/constant/RecruitmentConstant.java index c14ab7563..c8e3ac2f9 100644 --- a/src/test/java/com/gdschongik/gdsc/global/common/constant/RecruitmentConstant.java +++ b/src/test/java/com/gdschongik/gdsc/global/common/constant/RecruitmentConstant.java @@ -1,8 +1,8 @@ package com.gdschongik.gdsc.global.common.constant; import com.gdschongik.gdsc.domain.common.vo.Money; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.recruitment.domain.RoundType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -13,7 +13,7 @@ public class RecruitmentConstant { public static final LocalDateTime BETWEEN_START_AND_END_DATE = LocalDateTime.of(2024, 3, 3, 0, 0); public static final LocalDateTime WRONG_END_DATE = LocalDateTime.of(2024, 3, 2, 0, 0); public static final LocalDateTime END_DATE = LocalDateTime.of(2024, 3, 5, 0, 0); - public static final Period START_TO_END_PERIOD = Period.createPeriod(START_DATE, END_DATE); + public static final Period START_TO_END_PERIOD = Period.of(START_DATE, END_DATE); public static final Money FEE = Money.from(20000L); public static final BigDecimal FEE_AMOUNT = BigDecimal.valueOf(20000); @@ -24,8 +24,7 @@ public class RecruitmentConstant { public static final String ROUND_TWO_RECRUITMENT_NAME = "2024학년도 1학기 2차 모집"; public static final LocalDateTime ROUND_TWO_START_DATE = LocalDateTime.of(2024, 3, 8, 0, 0); public static final LocalDateTime ROUND_TWO_END_DATE = LocalDateTime.of(2024, 3, 10, 0, 0); - public static final Period ROUND_TWO_START_TO_END_PERIOD = - Period.createPeriod(ROUND_TWO_START_DATE, ROUND_TWO_END_DATE); + public static final Period ROUND_TWO_START_TO_END_PERIOD = Period.of(ROUND_TWO_START_DATE, ROUND_TWO_END_DATE); private RecruitmentConstant() {} } diff --git a/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java b/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java index bdc0afaea..dbb5d4a05 100644 --- a/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java +++ b/src/test/java/com/gdschongik/gdsc/global/common/constant/StudyConstant.java @@ -1,6 +1,6 @@ package com.gdschongik.gdsc.global.common.constant; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.study.domain.StudyType; import java.time.DayOfWeek; import java.time.LocalDateTime; @@ -27,7 +27,7 @@ private StudyConstant() {} // Study (2024-09-01 ~ 2024-10-27) public static final LocalDateTime STUDY_START_DATETIME = LocalDateTime.of(2024, 9, 1, 0, 0); public static final LocalDateTime STUDY_END_DATETIME = STUDY_START_DATETIME.plusWeeks(8); - public static final Period STUDY_ONGOING_PERIOD = Period.createPeriod(STUDY_START_DATETIME, STUDY_END_DATETIME); + public static final Period STUDY_ONGOING_PERIOD = Period.of(STUDY_START_DATETIME, STUDY_END_DATETIME); public static final String STUDY_NOTION_LINK = "notionLink"; public static final String STUDY_INTRODUCTION = "introduction"; diff --git a/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java b/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java index f24a39dcb..1f64b54ac 100644 --- a/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java +++ b/src/test/java/com/gdschongik/gdsc/helper/FixtureHelper.java @@ -10,6 +10,7 @@ import com.gdschongik.gdsc.domain.common.model.SemesterType; import com.gdschongik.gdsc.domain.common.vo.Money; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.coupon.domain.Coupon; import com.gdschongik.gdsc.domain.coupon.domain.IssuedCoupon; import com.gdschongik.gdsc.domain.member.domain.Member; @@ -17,7 +18,6 @@ import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; import com.gdschongik.gdsc.domain.recruitment.domain.RoundType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.domain.Study; import com.gdschongik.gdsc.domain.study.domain.StudyDetail; import java.time.LocalDateTime; @@ -26,7 +26,7 @@ public class FixtureHelper { public Member createGuestMember(Long id) { - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); ReflectionTestUtils.setField(member, "id", id); return member; } @@ -66,24 +66,24 @@ public RecruitmentRound createRecruitmentRound( Integer academicYear, SemesterType semesterType, Money fee) { - Recruitment recruitment = Recruitment.createRecruitment( - academicYear, semesterType, fee, FEE_NAME, Period.createPeriod(SEMESTER_START_DATE, SEMESTER_END_DATE)); + Recruitment recruitment = Recruitment.create( + academicYear, semesterType, fee, FEE_NAME, Period.of(SEMESTER_START_DATE, SEMESTER_END_DATE)); return RecruitmentRound.create( - RECRUITMENT_ROUND_NAME, Period.createPeriod(startDate, endDate), recruitment, RoundType.FIRST); + RECRUITMENT_ROUND_NAME, Period.of(startDate, endDate), recruitment, RoundType.FIRST); } public Membership createMembership(Member member, RecruitmentRound recruitmentRound) { - return Membership.createMembership(member, recruitmentRound); + return Membership.create(member, recruitmentRound); } public IssuedCoupon createAndIssue(Money money, Member member) { - Coupon coupon = Coupon.createCoupon("테스트쿠폰", money); - return IssuedCoupon.issue(coupon, member); + Coupon coupon = Coupon.create("테스트쿠폰", money); + return IssuedCoupon.create(coupon, member); } public Study createStudy(Member mentor, Period period, Period applicationPeriod) { - return Study.createStudy( + return Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -103,13 +103,12 @@ public Study createStudyWithMentor(Long mentorId, Period period, Period applicat } public StudyDetail createStudyDetail(Study study, LocalDateTime startDate, LocalDateTime endDate) { - return StudyDetail.createStudyDetail(study, 1L, ATTENDANCE_NUMBER, Period.createPeriod(startDate, endDate)); + return StudyDetail.create(study, 1L, ATTENDANCE_NUMBER, Period.of(startDate, endDate)); } public StudyDetail createNewStudyDetail( Long id, Study study, Long week, LocalDateTime startDate, LocalDateTime endDate) { - StudyDetail studyDetail = - StudyDetail.createStudyDetail(study, week, ATTENDANCE_NUMBER, Period.createPeriod(startDate, endDate)); + StudyDetail studyDetail = StudyDetail.create(study, week, ATTENDANCE_NUMBER, Period.of(startDate, endDate)); ReflectionTestUtils.setField(studyDetail, "id", id); return studyDetail; } diff --git a/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java b/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java index 7ef757ac1..06ed3515b 100644 --- a/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java +++ b/src/test/java/com/gdschongik/gdsc/helper/IntegrationTest.java @@ -9,6 +9,7 @@ import com.gdschongik.gdsc.domain.common.model.SemesterType; import com.gdschongik.gdsc.domain.common.vo.Money; +import com.gdschongik.gdsc.domain.common.vo.Period; import com.gdschongik.gdsc.domain.coupon.dao.CouponRepository; import com.gdschongik.gdsc.domain.coupon.dao.IssuedCouponRepository; import com.gdschongik.gdsc.domain.coupon.domain.Coupon; @@ -29,7 +30,6 @@ import com.gdschongik.gdsc.domain.recruitment.domain.Recruitment; import com.gdschongik.gdsc.domain.recruitment.domain.RecruitmentRound; import com.gdschongik.gdsc.domain.recruitment.domain.RoundType; -import com.gdschongik.gdsc.domain.recruitment.domain.vo.Period; import com.gdschongik.gdsc.domain.study.dao.StudyAchievementRepository; import com.gdschongik.gdsc.domain.study.dao.StudyDetailRepository; import com.gdschongik.gdsc.domain.study.dao.StudyHistoryRepository; @@ -145,7 +145,7 @@ protected void logoutAndReloginAs(Long memberId, MemberRole memberRole) { } protected Member createMember() { - Member member = Member.createGuestMember(OAUTH_ID); + Member member = Member.createGuest(OAUTH_ID); memberRepository.save(member); member.completeUnivEmailVerification(UNIV_EMAIL); @@ -158,7 +158,7 @@ protected Member createMember() { } protected Member createGuestMember() { - Member guestMember = Member.createGuestMember(OAUTH_ID); + Member guestMember = Member.createGuest(OAUTH_ID); return memberRepository.save(guestMember); } @@ -206,30 +206,30 @@ protected RecruitmentRound createRecruitmentRound( Recruitment recruitment = createRecruitment(academicYear, semesterType, fee); RecruitmentRound recruitmentRound = - RecruitmentRound.create(name, Period.createPeriod(startDate, endDate), recruitment, roundType); + RecruitmentRound.create(name, Period.of(startDate, endDate), recruitment, roundType); return recruitmentRoundRepository.save(recruitmentRound); } protected Recruitment createRecruitment(Integer academicYear, SemesterType semesterType, Money fee) { - Recruitment recruitment = Recruitment.createRecruitment( - academicYear, semesterType, fee, FEE_NAME, Period.createPeriod(SEMESTER_START_DATE, SEMESTER_END_DATE)); + Recruitment recruitment = Recruitment.create( + academicYear, semesterType, fee, FEE_NAME, Period.of(SEMESTER_START_DATE, SEMESTER_END_DATE)); return recruitmentRepository.save(recruitment); } protected Membership createMembership(Member member, RecruitmentRound recruitmentRound) { - Membership membership = Membership.createMembership(member, recruitmentRound); + Membership membership = Membership.create(member, recruitmentRound); return membershipRepository.save(membership); } protected IssuedCoupon createAndIssue(Money money, Member member) { - Coupon coupon = Coupon.createCoupon("테스트쿠폰", money); + Coupon coupon = Coupon.create("테스트쿠폰", money); couponRepository.save(coupon); - IssuedCoupon issuedCoupon = IssuedCoupon.issue(coupon, member); + IssuedCoupon issuedCoupon = IssuedCoupon.create(coupon, member); return issuedCouponRepository.save(issuedCoupon); } protected Study createStudy(Member mentor, Period period, Period applicationPeriod) { - Study study = Study.createStudy( + Study study = Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -246,7 +246,7 @@ protected Study createStudy(Member mentor, Period period, Period applicationPeri } protected Study createNewStudy(Member mentor, Long totalWeek, Period period, Period applicationPeriod) { - Study study = Study.createStudy( + Study study = Study.create( ACADEMIC_YEAR, SEMESTER_TYPE, STUDY_TITLE, @@ -263,14 +263,12 @@ protected Study createNewStudy(Member mentor, Long totalWeek, Period period, Per } protected StudyDetail createStudyDetail(Study study, LocalDateTime startDate, LocalDateTime endDate) { - StudyDetail studyDetail = - StudyDetail.createStudyDetail(study, 1L, ATTENDANCE_NUMBER, Period.createPeriod(startDate, endDate)); + StudyDetail studyDetail = StudyDetail.create(study, 1L, ATTENDANCE_NUMBER, Period.of(startDate, endDate)); return studyDetailRepository.save(studyDetail); } protected StudyDetail createNewStudyDetail(Long week, Study study, LocalDateTime startDate, LocalDateTime endDate) { - StudyDetail studyDetail = - StudyDetail.createStudyDetail(study, week, ATTENDANCE_NUMBER, Period.createPeriod(startDate, endDate)); + StudyDetail studyDetail = StudyDetail.create(study, week, ATTENDANCE_NUMBER, Period.of(startDate, endDate)); return studyDetailRepository.save(studyDetail); }