Skip to content

Commit 090475a

Browse files
authored
Merge pull request #546 from k163377/add_parameter_names_test
Add test case for KNAI.hasCreatorAnnotation
2 parents 521cf86 + df0630b commit 090475a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/ParameterNameTests.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,16 @@ class TestJacksonWithKotlin {
209209
assertThat(test1out, equalTo(pascalCasedJson))
210210
}
211211

212+
private class HasSameParamNameConstructor(val value: Int) {
213+
constructor(value: Short) : this(value.toInt() + 100)
214+
}
215+
216+
@Test fun findingPrimaryConstructor() {
217+
val json = "{\"value\":1}"
218+
219+
// If there is more than one constructor, the primary constructor will be used.
220+
assertEquals(1, normalCasedMapper.readValue<HasSameParamNameConstructor>(json).value)
221+
}
212222

213223
// ==================
214224

0 commit comments

Comments
 (0)