Skip to content

Commit

Permalink
Merge pull request #546 from k163377/add_parameter_names_test
Browse files Browse the repository at this point in the history
Add test case for KNAI.hasCreatorAnnotation
  • Loading branch information
k163377 committed Mar 22, 2023
2 parents 521cf86 + df0630b commit 090475a
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -209,6 +209,16 @@ class TestJacksonWithKotlin {
assertThat(test1out, equalTo(pascalCasedJson))
}

private class HasSameParamNameConstructor(val value: Int) {
constructor(value: Short) : this(value.toInt() + 100)
}

@Test fun findingPrimaryConstructor() {
val json = "{\"value\":1}"

// If there is more than one constructor, the primary constructor will be used.
assertEquals(1, normalCasedMapper.readValue<HasSameParamNameConstructor>(json).value)
}

// ==================

Expand Down

0 comments on commit 090475a

Please sign in to comment.