Skip to content

Commit

Permalink
add failing test case for Github #71, internal property name mangling…
Browse files Browse the repository at this point in the history
… is affecting how Jackson sees the property names, and is ugly when serializing as JSON
  • Loading branch information
apatrida committed Oct 29, 2019
1 parent 6d9ef0c commit 4074b06
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.fasterxml.jackson.module.kotlin.test.failing

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import org.junit.Test
import kotlin.test.assertEquals

class TestGithub71 {
open class Identifiable {
internal var identity: Long? = null
}

@Test
fun testInternalPropertySerliazation() {
val json = jacksonObjectMapper().writeValueAsString(Identifiable())
assertEquals("{\"identity\":null}", json) // fails: {"identity$jackson_module_kotlin":null}
val newInstance = jacksonObjectMapper().readValue<Identifiable>(json)
assertEquals(Identifiable(), newInstance)
}
}

0 comments on commit 4074b06

Please sign in to comment.