-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'FasterXML/2.19'
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/test/kotlin/tools/jackson/module/kotlin/test/github/GitHub841.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,35 @@ | ||
package tools.jackson.module.kotlin.test.github | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator | ||
import com.fasterxml.jackson.annotation.JsonInclude | ||
import tools.jackson.module.kotlin.jsonMapper | ||
import tools.jackson.module.kotlin.kotlinModule | ||
import tools.jackson.module.kotlin.readValue | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class GitHub841 { | ||
object Foo { | ||
override fun toString(): String = "Foo()" | ||
|
||
@JvmStatic | ||
@JsonCreator | ||
fun deserialize(): Foo { | ||
return Foo | ||
} | ||
} | ||
|
||
private val mapper = jsonMapper { | ||
changeDefaultPropertyInclusion { it.withValueInclusion(JsonInclude.Include.NON_ABSENT) } | ||
addModule(kotlinModule()) | ||
} | ||
|
||
@Test | ||
fun shouldDeserializeSimpleObject() { | ||
val value = Foo | ||
val serialized = mapper.writeValueAsString(value) | ||
val deserialized = mapper.readValue<Foo>(serialized) | ||
|
||
assertEquals(value, deserialized) | ||
} | ||
} |