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

Commit 8005c12

Browse files
committed
プロパティ名変換のテストを追加
1 parent cef2aa6 commit 8005c12

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package mapk.core
2+
3+
import com.google.common.base.CaseFormat
4+
import com.wrongwrong.mapk.core.KMapper
5+
import org.junit.jupiter.api.Assertions.assertEquals
6+
import org.junit.jupiter.api.DisplayName
7+
import org.junit.jupiter.api.Test
8+
9+
private class CamelCaseDst(val camelCase: String)
10+
11+
@DisplayName("プロパティ名変換のテスト")
12+
class PropertyNameConverterTest {
13+
@Test
14+
@DisplayName("スネークケースsrc -> キャメルケースdst")
15+
fun test() {
16+
val expected = "snakeCase"
17+
val src = mapOf("camel_case" to expected)
18+
19+
val mapper = KMapper(CamelCaseDst::class) { CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, it) }
20+
val result = mapper.map(src)
21+
22+
assertEquals(expected, result.camelCase)
23+
}
24+
}

0 commit comments

Comments
 (0)