Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit ebb0cbc

Browse files
committed
テストケース追加
1 parent 66ad13f commit ebb0cbc

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.mapk.kmapper
2+
3+
import org.junit.jupiter.api.DisplayName
4+
import org.junit.jupiter.api.Test
5+
import org.junit.jupiter.api.assertDoesNotThrow
6+
import org.junit.jupiter.api.assertThrows
7+
8+
@Suppress("UNUSED_VARIABLE")
9+
@DisplayName("BoundKMapperの初期化時にエラーを吐かせるテスト")
10+
internal class BoundKMapperInitTest {
11+
data class Dst1(val foo: Int, val bar: Short, val baz: Long)
12+
data class Dst2(val foo: Int, val bar: Short, val baz: Long = 0)
13+
14+
data class Src(val foo: Int, val bar: Short)
15+
16+
@Test
17+
@DisplayName("引数が足りない場合のエラーテスト")
18+
fun isError() {
19+
assertThrows<IllegalArgumentException> {
20+
val mapper: BoundKMapper<Src, Dst1> = BoundKMapper()
21+
}
22+
}
23+
24+
@Test
25+
@DisplayName("足りないのがオプショナルな引数の場合エラーにならないテスト")
26+
fun isCollect() {
27+
assertDoesNotThrow { val mapper: BoundKMapper<Src, Dst2> = BoundKMapper(::Dst2) }
28+
}
29+
}

0 commit comments

Comments
 (0)