-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c307ad4
commit 73f4ebf
Showing
2 changed files
with
38 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github145Failing.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.fasterxml.jackson.module.kotlin.test.github.failing | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator | ||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper | ||
import com.fasterxml.jackson.module.kotlin.readValue | ||
import org.junit.Test | ||
|
||
/** | ||
* Class containing now-failing tests from [com.fasterxml.jackson.module.kotlin.test.github.TestGithub145], | ||
* since "Rewrite Bean Property Introspection logic in Jackson 2.x #4515" from | ||
* [jackson-databind#4515](https://github.com/FasterXML/jackson-databind/issues/4515) was completed. | ||
*/ | ||
@Suppress("UNUSED_VARIABLE") | ||
class Github145Failing { | ||
|
||
private val objectMapper = jacksonObjectMapper() | ||
|
||
// Cannot have companion object in class declared within function | ||
class Person7 constructor(val preName: String, val lastName: String) { | ||
private constructor(preNameAndLastName: String) : this( | ||
preNameAndLastName.substringBefore(","), | ||
preNameAndLastName.substringAfter(",") | ||
) | ||
|
||
companion object { | ||
@JsonCreator | ||
@JvmStatic | ||
fun createFromJson(preNameAndLastName: String): Person7 { | ||
return Person7(preNameAndLastName) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun testPerson7() { | ||
val person7Json = objectMapper.readValue<Person7>("""{"preName":"TestPreName","lastName":"TestLastname"}""") | ||
} | ||
} |