File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ Authors:
13
13
14
14
Contributors :
15
15
16
+ Marshall Pierce (marshallpierce @github )
17
+ * #474 : Reported disrespect for @JsonProperty on parent class
18
+
16
19
Christopher Mason (masoncj @github )
17
20
* #194 : Contributed test case for @JsonIdentityInfo usage
18
21
(2.12 .NEXT )
Original file line number Diff line number Diff line change
1
+ package com.fasterxml.jackson.module.kotlin.test.github
2
+
3
+ import com.fasterxml.jackson.annotation.JsonProperty
4
+ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
5
+ import org.junit.Test
6
+ import kotlin.test.assertEquals
7
+
8
+ class TestGithub474 {
9
+ @Test
10
+ fun jsonPropertyAnnotationRespectedOnParentClass () {
11
+ open class Parent (@JsonProperty(" parent-prop" ) val parent : String )
12
+ class Child (@JsonProperty(" child-prop" ) val child : String ) : Parent(child)
13
+
14
+ assertEquals(
15
+ """ {"child-prop":"foo","parent-prop":"foo"}""" ,
16
+ jacksonObjectMapper().writeValueAsString(Child (" foo" ))
17
+ )
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments