Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Github145.testPerson7() failing test #802

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,4 @@ class TestGithub145 {
val person6Json = objectMapper.readValue<Person6>("""{"preName":"TestPreName","lastName":"TestLastname"}""")
}

// 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 person7String = objectMapper.readValue<Person7>(""""TestPreName,TestLastname"""")
val person7Json = objectMapper.readValue<Person7>("""{"preName":"TestPreName","lastName":"TestLastname"}""")
}
}
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"}""")
}
}