Skip to content

Commit d88a3d6

Browse files
author
ddomanine
committed
rebased to 2.13 and applied patch
1 parent 47bf1cf commit d88a3d6

File tree

1 file changed

+30
-8
lines changed
  • src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github

1 file changed

+30
-8
lines changed

src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/Github490.kt

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,61 @@ import org.hamcrest.CoreMatchers
77
import org.hamcrest.MatcherAssert.assertThat
88
import org.junit.Test
99

10-
class Github490 {
10+
class TestGithub490 {
11+
val mapper = jacksonObjectMapper()
12+
val value: DataClassWithAllNullableParams = mapper.readValue(
13+
"{" +
14+
"\"jsonNodeValueWithNullAsDefaultProvidedNull\":null, " +
15+
"\"jsonNodeValueProvidedNull\":null}"
16+
)
1117

1218
@Test
13-
fun testKotlinDeserialization() {
14-
val mapper = jacksonObjectMapper()
15-
val value: DataClassWithAllNullableParams = mapper.readValue("{" +
16-
"\"jsonNodeValueWithNullAsDefaultProvidedNull\":null, " +
17-
"\"jsonNodeValueProvidedNull\":null}")
19+
fun testKotlinDeserialization_intValue() {
1820
assertThat(
1921
"Nullable missing Int value should be deserialized as null",
2022
value.intValue,
2123
CoreMatchers.nullValue()
2224
)
25+
}
26+
27+
@Test
28+
fun testKotlinDeserialization_stringValue() {
2329
assertThat(
2430
"Nullable missing String value should be deserialized as null",
2531
value.stringValue,
2632
CoreMatchers.nullValue()
2733
)
34+
}
35+
36+
@Test
37+
fun testKotlinDeserialization_jsonNodeValue() {
2838
assertThat(
2939
"Nullable missing JsonNode value should be deserialized as null and not as NullNode",
3040
value.jsonNodeValue,
3141
CoreMatchers.nullValue()
3242
)
43+
}
44+
45+
@Test
46+
fun testKotlinDeserialization_jsonNodeValueProvidedNull() {
3347
assertThat(
34-
"Nullable missing JsonNode value should be deserialized as null and not as NullNode",
48+
"Nullable JsonNode value provided as null should be deserialized as null and not as NullNode",
3549
value.jsonNodeValueProvidedNull,
3650
CoreMatchers.nullValue()
3751
)
52+
}
53+
54+
@Test
55+
fun testKotlinDeserialization_jsonNodeValueWithNullAsDefault() {
3856
assertThat(
3957
"Nullable by default missing JsonNode value should be deserialized as null and not as NullNode",
4058
value.jsonNodeValueWithNullAsDefault,
4159
CoreMatchers.nullValue()
4260
)
61+
}
62+
63+
@Test
64+
fun testKotlinDeserialization_jsonNodeValueWithNullAsDefaultProvidedNull() {
4365
assertThat(
4466
"Nullable by default JsonNode with provided null value in payload should be deserialized as null and not as NullNode",
4567
value.jsonNodeValueWithNullAsDefaultProvidedNull,
@@ -55,4 +77,4 @@ data class DataClassWithAllNullableParams(
5577
val jsonNodeValueProvidedNull: JsonNode?,
5678
val jsonNodeValueWithNullAsDefault: JsonNode? = null,
5779
val jsonNodeValueWithNullAsDefaultProvidedNull: JsonNode? = null
58-
)
80+
)

0 commit comments

Comments
 (0)