-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test: Calendar, Schedule, Scheduleinfo Fixture 생성
Resolves: #38
- Loading branch information
Showing
3 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
application/wypl-core/src/test/java/com/wypl/wyplcore/CalendarFixture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.wypl.wyplcore; | ||
|
||
import com.wypl.jpacalendardomain.calendar.domain.Calendar; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum CalendarFixture { | ||
|
||
PRIVATE_CALENDAR("개인 달력", "개인 달력입니다.", 1L, false), | ||
GROUP_CALENDAR1("와플 그룹 달력", "와플 화이팅", 2L, true), | ||
GROUP_CALENDAR2("CS 스터디 그룹 달력", "CS 재밋다!", 3L, true); | ||
|
||
private final String name; | ||
private final String description; | ||
private final Long ownerId; | ||
private final Boolean isShared; | ||
|
||
CalendarFixture(String name, String description, Long ownerId, Boolean isShared) { | ||
this.name = name; | ||
this.description = description; | ||
this.ownerId = ownerId; | ||
this.isShared = isShared; | ||
} | ||
|
||
public Calendar toEntity() { | ||
return Calendar.builder() | ||
.name(this.name) | ||
.description(this.description) | ||
.ownerId(this.ownerId) | ||
.isShared(this.isShared) | ||
.build(); | ||
} | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
application/wypl-core/src/test/java/com/wypl/wyplcore/ScheduleFixture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package com.wypl.wyplcore; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import com.wypl.jpacalendardomain.calendar.data.RepetitionCycle; | ||
import com.wypl.jpacalendardomain.calendar.domain.Schedule; | ||
import com.wypl.jpacalendardomain.calendar.domain.ScheduleInfo; | ||
|
||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ScheduleFixture { | ||
|
||
DAILY_SCHEDULE( | ||
"일일 일정", | ||
"매일 반복되는 일정입니다.", | ||
LocalDateTime.of(2024, 10, 20, 9, 0), | ||
LocalDateTime.of(2024, 10, 20, 10, 0), | ||
LocalDate.of(2024, 10, 20), | ||
LocalDate.of(2024, 12, 31), | ||
RepetitionCycle.DAY, | ||
null, | ||
null | ||
), | ||
WEEKLY_SCHEDULE( | ||
"주간 일정", | ||
"매주 월,수,금에 반복되는 일정입니다.", | ||
LocalDateTime.of(2024, 10, 20, 14, 0), | ||
LocalDateTime.of(2024, 10, 20, 15, 0), | ||
LocalDate.of(2024, 10, 20), | ||
LocalDate.of(2025, 1, 1), | ||
RepetitionCycle.WEEK, | ||
((1 << 1) | (1 << 3) | (1 << 5)), // 월, 수, 금 반복 | ||
1 // 매주 반복 | ||
), | ||
WEEKLY_SCHEDULE_WITHOUT_DAY_OF_WEEK( | ||
"2주 마다 반복되는 일정", | ||
"2주 마다 반복되는 일정입니다.", | ||
LocalDateTime.of(2024, 10, 20, 14, 0), | ||
LocalDateTime.of(2024, 10, 21, 14, 0), | ||
LocalDate.of(2024, 10, 20), | ||
LocalDate.of(2025, 1, 1), | ||
RepetitionCycle.WEEK, | ||
null, // 월, 수, 금 반복 | ||
2 // 매주 반복 | ||
), | ||
MONTHLY_SCHEDULE( | ||
"월간 일정", | ||
"매달 첫째 주 화요일에 반복되는 일정입니다.", | ||
LocalDateTime.of(2024, 10, 20, 10, 0), | ||
LocalDateTime.of(2024, 10, 20, 11, 0), | ||
LocalDate.of(2024, 10, 20), | ||
LocalDate.of(2025, 2, 1), | ||
RepetitionCycle.MONTH, | ||
2, // 화요일 | ||
1 // 매월 반복 | ||
); | ||
|
||
private final String title; | ||
private final String description; | ||
private final LocalDateTime startDateTime; | ||
private final LocalDateTime endDateTime; | ||
private final LocalDate repetitionStartDate; | ||
private final LocalDate repetitionEndDate; | ||
private final RepetitionCycle repetitionCycle; | ||
private final Integer dayOfWeek; | ||
private final Integer weekInterval; | ||
|
||
ScheduleFixture(String title, String description, LocalDateTime startDateTime, LocalDateTime endDateTime, | ||
LocalDate repetitionStartDate, LocalDate repetitionEndDate, RepetitionCycle repetitionCycle, | ||
Integer dayOfWeek, Integer weekInterval) { | ||
this.title = title; | ||
this.description = description; | ||
this.startDateTime = startDateTime; | ||
this.endDateTime = endDateTime; | ||
this.repetitionStartDate = repetitionStartDate; | ||
this.repetitionEndDate = repetitionEndDate; | ||
this.repetitionCycle = repetitionCycle; | ||
this.dayOfWeek = dayOfWeek; | ||
this.weekInterval = weekInterval; | ||
} | ||
|
||
public Schedule toEntity(ScheduleInfo scheduleInfo) { | ||
return Schedule.builder() | ||
.scheduleInfo(scheduleInfo) | ||
.title(this.title) | ||
.description(this.description) | ||
.startDateTime(this.startDateTime) | ||
.endDateTime(this.endDateTime) | ||
.repetitionStartDate(this.repetitionStartDate) | ||
.repetitionEndDate(this.repetitionEndDate) | ||
.repetitionCycle(this.repetitionCycle) | ||
.dayOfWeek(this.dayOfWeek) | ||
.weekInterval(this.weekInterval) | ||
.build(); | ||
} | ||
|
||
|
||
|
||
} |
30 changes: 30 additions & 0 deletions
30
application/wypl-core/src/test/java/com/wypl/wyplcore/ScheduleInfoFixture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.wypl.wyplcore; | ||
|
||
import java.util.Collections; | ||
|
||
import com.wypl.jpacalendardomain.calendar.domain.Calendar; | ||
import com.wypl.jpacalendardomain.calendar.domain.ScheduleInfo; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum ScheduleInfoFixture { | ||
|
||
PRIVATE_SCHEDULE_INFO(1L), | ||
GROUP_SCHEDULE_INFO_1(2L), | ||
GROUP_SCHEDULE_INFO_2( 3L); | ||
|
||
private final Long creatorId; | ||
|
||
ScheduleInfoFixture(Long creatorId) { | ||
this.creatorId = creatorId; | ||
} | ||
|
||
public ScheduleInfo toEntity(Calendar calendar) { | ||
return ScheduleInfo.builder() | ||
.calendar(calendar) | ||
.creatorId(this.creatorId) | ||
.build(); | ||
} | ||
|
||
} |