Skip to content

Commit fade3f6

Browse files
committed
Test for Kotlin class
1 parent e4f1f96 commit fade3f6

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/test/kotlin/com/fasterxml/jackson/module/kotlin/KotlinInstantiatorsTest.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.fasterxml.jackson.module.kotlin
22

33
import com.fasterxml.jackson.databind.deser.std.StdValueInstantiator
44
import org.junit.Assert.assertEquals
5+
import org.junit.Assert.assertTrue
56
import org.junit.Test
67

78
class KotlinInstantiatorsTest {
@@ -18,7 +19,6 @@ class KotlinInstantiatorsTest {
1819
private class DefaultClass
1920

2021
private val deserConfig = mapper.deserializationConfig
21-
private val beanDescription = deserConfig.introspect(mapper.constructType(String::class.java))
2222
private val defaultInstantiator = object : StdValueInstantiator(
2323
deserConfig,
2424
mapper.constructType(DefaultClass::class.java)
@@ -28,10 +28,24 @@ class KotlinInstantiatorsTest {
2828
fun `Provides default instantiator for Java class`() {
2929
val instantiator = kotlinInstantiators.findValueInstantiator(
3030
deserConfig,
31-
beanDescription,
31+
deserConfig.introspect(mapper.constructType(String::class.java)),
3232
defaultInstantiator
3333
)
3434

3535
assertEquals(defaultInstantiator, instantiator)
3636
}
37+
38+
@Test
39+
fun `Provides KotlinValueInstantiator for Kotlin class`() {
40+
class TestClass
41+
42+
val instantiator = kotlinInstantiators.findValueInstantiator(
43+
deserConfig,
44+
deserConfig.introspect(mapper.constructType(TestClass::class.java)),
45+
defaultInstantiator
46+
)
47+
48+
assertTrue(instantiator is StdValueInstantiator)
49+
assertTrue(instantiator::class == KotlinValueInstantiator::class)
50+
}
3751
}

0 commit comments

Comments
 (0)