File tree 1 file changed +27
-0
lines changed
src/test/kotlin/com/fasterxml/jackson/integtest/kotlin
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule
2
+ import com.fasterxml.jackson.dataformat.xml.XmlFactory
3
+ import com.fasterxml.jackson.dataformat.xml.XmlMapper
4
+ import com.fasterxml.jackson.integtest.BaseTest
5
+ import com.fasterxml.jackson.module.kotlin.registerKotlinModule
6
+ import javax.xml.stream.XMLInputFactory
7
+
8
+ class Jackson212MissingConstructorTest : BaseTest ()
9
+ {
10
+ /* *
11
+ * Succeeds in Jackson 2.11.x, but fails in Jackson 2.12.0
12
+ * See https://github.com/FasterXML/jackson-module-kotlin/issues/396
13
+ */
14
+ fun testMissingConstructor ()
15
+ {
16
+ val factory = XmlFactory (XMLInputFactory .newInstance())
17
+ val mapper = XmlMapper (factory, JacksonXmlModule ()).registerKotlinModule()
18
+
19
+ val xml = " <product><stuff></stuff></product>"
20
+ val product: Product = mapper.readValue(xml, Product ::class .java)
21
+
22
+ assertEquals(Product (null ), product)
23
+ }
24
+
25
+ private data class Stuff (val str : String? )
26
+ private data class Product (val stuff : Stuff ? )
27
+ }
You can’t perform that action at this time.
0 commit comments