-
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
16bf3a4
commit 088d405
Showing
5 changed files
with
66 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/test/kotlin/com/swm_standard/phote/entity/ExamResultTest.kt
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,51 @@ | ||
package com.swm_standard.phote.entity | ||
|
||
import com.navercorp.fixturemonkey.FixtureMonkey | ||
import com.navercorp.fixturemonkey.api.introspector.FieldReflectionArbitraryIntrospector | ||
import com.navercorp.fixturemonkey.kotlin.KotlinPlugin | ||
import com.navercorp.fixturemonkey.kotlin.giveMeBuilder | ||
import com.navercorp.fixturemonkey.kotlin.setExp | ||
import com.navercorp.fixturemonkey.kotlin.sizeExp | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class ExamResultTest { | ||
private val fixtureMonkey = | ||
FixtureMonkey | ||
.builder() | ||
.plugin(KotlinPlugin()) | ||
.objectIntrospector(FieldReflectionArbitraryIntrospector.INSTANCE) | ||
.build() | ||
|
||
@Test | ||
fun `문제 풀이한 총 문제수를 구한다`() { | ||
// given | ||
val exam: ExamResult = | ||
fixtureMonkey | ||
.giveMeBuilder<ExamResult>() | ||
.sizeExp(ExamResult::answers, 2) | ||
.sample() | ||
|
||
// when | ||
val totalQuantity = exam.calculateTotalQuantity() | ||
|
||
// then | ||
assertEquals(totalQuantity, 2) | ||
} | ||
|
||
@Test | ||
fun `totalCorrect가 증가한다`() { | ||
val count = 3 | ||
val totalCorrect = 2 | ||
val exam = | ||
fixtureMonkey | ||
.giveMeBuilder<ExamResult>() | ||
.setExp(ExamResult::totalCorrect, totalCorrect) | ||
.sample() | ||
|
||
exam.increaseTotalCorrect(count) | ||
|
||
assertThat(exam.totalCorrect).isEqualTo(totalCorrect + count) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters