-
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.
- Loading branch information
1 parent
d9eeb30
commit 8c908c9
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/test/java/com/gdschongik/gdsc/domain/study/domain/StudyHistoryTest.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,61 @@ | ||
package com.gdschongik.gdsc.domain.study.domain; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
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; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class StudyHistoryTest { | ||
|
||
FixtureHelper fixtureHelper = new FixtureHelper(); | ||
|
||
@Nested | ||
class 스터디_히스토리_생성시 { | ||
|
||
@Test | ||
void 수료여부는_false이다() { | ||
// given | ||
Member student = fixtureHelper.createRegularMember(1L); | ||
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)); | ||
|
||
// when | ||
StudyHistory studyHistory = StudyHistory.create(student, study); | ||
|
||
// then | ||
assertThat(studyHistory.getHasCompleted()).isFalse(); | ||
} | ||
} | ||
|
||
@Nested | ||
class 스터디_수료시 { | ||
|
||
@Test | ||
void 수료여부는_true이다() { | ||
// given | ||
Member student = fixtureHelper.createRegularMember(1L); | ||
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)); | ||
|
||
StudyHistory studyHistory = StudyHistory.create(student, study); | ||
|
||
// when | ||
studyHistory.complete(); | ||
|
||
// then | ||
assertThat(studyHistory.getHasCompleted()).isTrue(); | ||
} | ||
} | ||
} |