Skip to content

Commit d5bfde2

Browse files
committed
1 parent 1832684 commit d5bfde2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,17 @@ class TestJacksonWithKotlin {
200200
assertEquals(pascalCasedJson, test1out)
201201
}
202202

203+
private class HasSameParamNameConstructor(val value: Int) {
204+
constructor(value: Short) : this(value.toInt() + 100)
205+
}
206+
207+
@Test fun findingPrimaryConstructor() {
208+
val json = "{\"value\":1}"
209+
210+
// If there is more than one constructor, the primary constructor will be used.
211+
assertEquals(1, normalCasedMapper.readValue<HasSameParamNameConstructor>(json).value)
212+
}
213+
203214
// ==================
204215

205216
private class StateObjectWithFactory private constructor(

0 commit comments

Comments
 (0)