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

Commit a35db64

Browse files
committed
Enumのマッピングテストを追加
1 parent 462e0d3 commit a35db64

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package mapk.core
2+
3+
import com.wrongwrong.mapk.core.KMapper
4+
import org.junit.jupiter.api.Assertions.assertEquals
5+
import org.junit.jupiter.api.DisplayName
6+
import org.junit.jupiter.params.ParameterizedTest
7+
import org.junit.jupiter.params.provider.EnumSource
8+
9+
enum class JvmLanguage {
10+
Java, Scala, Groovy, Kotlin
11+
}
12+
13+
private class EnumMappingDst(val language: JvmLanguage?)
14+
15+
@DisplayName("文字列 -> Enumのマッピングテスト")
16+
class EnumMappingTest {
17+
private val mapper = KMapper(EnumMappingDst::class)
18+
19+
@ParameterizedTest(name = "Non-Null要求")
20+
@EnumSource(value = JvmLanguage::class)
21+
fun test(language: JvmLanguage) {
22+
val result = mapper.map("language" to language.name)
23+
24+
assertEquals(language, result.language)
25+
}
26+
}

0 commit comments

Comments
 (0)