File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
src/test/kotlin/com/fasterxml/jackson/module/kotlin Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com.fasterxml.jackson.module.kotlin
2
+
3
+ import com.fasterxml.jackson.databind.deser.std.StdValueInstantiator
4
+ import org.junit.Assert.assertEquals
5
+ import org.junit.Test
6
+
7
+ class KotlinInstantiatorsTest {
8
+ private val mapper = jacksonObjectMapper()
9
+
10
+ private val kotlinInstantiators = KotlinInstantiators (
11
+ ReflectionCache (10 ),
12
+ nullToEmptyCollection = false ,
13
+ nullToEmptyMap = false ,
14
+ nullIsSameAsDefault = false ,
15
+ strictNullChecks = false
16
+ )
17
+
18
+ private class DefaultClass
19
+
20
+ private val deserConfig = mapper.deserializationConfig
21
+ private val beanDescription = deserConfig.introspect(mapper.constructType(String ::class .java))
22
+ private val defaultInstantiator = object : StdValueInstantiator (
23
+ deserConfig,
24
+ mapper.constructType(DefaultClass ::class .java)
25
+ ) {}
26
+
27
+ @Test
28
+ fun `Provides default instantiator for Java class` () {
29
+ val instantiator = kotlinInstantiators.findValueInstantiator(
30
+ deserConfig,
31
+ beanDescription,
32
+ defaultInstantiator
33
+ )
34
+
35
+ assertEquals(defaultInstantiator, instantiator)
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments