File tree Expand file tree Collapse file tree 2 files changed +38
-21
lines changed
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github Expand file tree Collapse file tree 2 files changed +38
-21
lines changed Original file line number Diff line number Diff line change @@ -119,25 +119,4 @@ class TestGithub145 {
119119 val person6Json = objectMapper.readValue<Person6 >(""" {"preName":"TestPreName","lastName":"TestLastname"}""" )
120120 }
121121
122- // Cannot have companion object in class declared within function
123- class Person7 constructor(val preName : String , val lastName : String ) {
124- private constructor (preNameAndLastName: String ) : this (
125- preNameAndLastName.substringBefore(" ," ),
126- preNameAndLastName.substringAfter(" ," )
127- )
128-
129- companion object {
130- @JsonCreator
131- @JvmStatic
132- fun createFromJson (preNameAndLastName : String ): Person7 {
133- return Person7 (preNameAndLastName)
134- }
135- }
136- }
137-
138- @Test
139- fun testPerson7 () {
140- val person7String = objectMapper.readValue<Person7 >(""" "TestPreName,TestLastname"""" )
141- val person7Json = objectMapper.readValue<Person7 >(""" {"preName":"TestPreName","lastName":"TestLastname"}""" )
142- }
143122}
Original file line number Diff line number Diff line change 1+ package com.fasterxml.jackson.module.kotlin.test.github.failing
2+
3+ import com.fasterxml.jackson.annotation.JsonCreator
4+ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
5+ import com.fasterxml.jackson.module.kotlin.readValue
6+ import org.junit.Test
7+
8+ /* *
9+ * Class containing now-failing tests from [com.fasterxml.jackson.module.kotlin.test.github.TestGithub145],
10+ * since "Rewrite Bean Property Introspection logic in Jackson 2.x #4515" from
11+ * [jackson-databind#4515](https://github.com/FasterXML/jackson-databind/issues/4515) was completed.
12+ */
13+ @Suppress(" UNUSED_VARIABLE" )
14+ class Github145Failing {
15+
16+ private val objectMapper = jacksonObjectMapper()
17+
18+ // Cannot have companion object in class declared within function
19+ class Person7 constructor(val preName : String , val lastName : String ) {
20+ private constructor (preNameAndLastName: String ) : this (
21+ preNameAndLastName.substringBefore(" ," ),
22+ preNameAndLastName.substringAfter(" ," )
23+ )
24+
25+ companion object {
26+ @JsonCreator
27+ @JvmStatic
28+ fun createFromJson (preNameAndLastName : String ): Person7 {
29+ return Person7 (preNameAndLastName)
30+ }
31+ }
32+ }
33+
34+ @Test
35+ fun testPerson7 () {
36+ val person7Json = objectMapper.readValue<Person7 >(""" {"preName":"TestPreName","lastName":"TestLastname"}""" )
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments