Skip to content

Commit f3cdfb4

Browse files
committed
test: 테스트 수정
1 parent 159dac5 commit f3cdfb4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/kotlin/lotto/domain/Statistics.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package lotto.domain
22

33
data class Statistics(val rank: Int, val matchCount: Int) {
44
fun earnings(): Long {
5-
return (earningPriceByRanking() * matchCount).toLong()
5+
return earningPriceByRanking() * matchCount
66
}
77

8-
private fun earningPriceByRanking() =
8+
private fun earningPriceByRanking(): Long =
99
when (rank) {
1010
RANK_FIRST -> FIRST_RANK_EARNING
1111
RANK_SECOND -> SECOND_RANK_EARNING
@@ -22,12 +22,12 @@ data class Statistics(val rank: Int, val matchCount: Int) {
2222
private const val RANK_FOURTH = 4
2323
private const val RANK_FIFTH = 5
2424

25-
private const val FIRST_RANK_EARNING = 2_000_000_000
26-
private const val SECOND_RANK_EARNING = 1_500_000
27-
private const val THIRD_RANK_EARNING = 50_000
28-
private const val FOURTH_RANK_EARNING = 5_000
29-
private const val FIFTH_RANK_EARNING = 0
30-
private const val NO_RANK_EARNING = 0
25+
private const val FIRST_RANK_EARNING = 2_000_000_000L
26+
private const val SECOND_RANK_EARNING = 1_500_000L
27+
private const val THIRD_RANK_EARNING = 50_000L
28+
private const val FOURTH_RANK_EARNING = 5_000L
29+
private const val FIFTH_RANK_EARNING = 0L
30+
private const val NO_RANK_EARNING = 0L
3131

3232
fun of(
3333
userLottos: List<Lotto>,

src/test/kotlin/lotto/domain/StatisticsTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class StatisticsTest : DescribeSpec({
3939
describe("earningsRatio test") {
4040
it("Integer Overflow 발생하지 않도록 헨들링") {
4141
val statistics = Statistics(rank = 1, matchCount = 2)
42-
val actual = Statistics.earningsRatio(statistics)
42+
val actual = statistics.earnings()
4343
actual shouldBe 4_000_000_000
4444
}
4545

4646
it("3등 3장") {
4747
val statistics = Statistics(rank = 3, matchCount = 3)
48-
val actual = Statistics.earningsRatio(statistics)
48+
val actual = statistics.earnings()
4949
actual shouldBe 150000
5050
}
5151
}

0 commit comments

Comments
 (0)