Skip to content

Commit dd047d6

Browse files
committed
Add failing test for GitHub issue 337
1 parent 00f8432 commit dd047d6

File tree

1 file changed

+66
-0
lines changed
  • src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.fasterxml.jackson.module.kotlin.test.github.failing
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude
4+
import com.fasterxml.jackson.annotation.JsonProperty
5+
import com.fasterxml.jackson.databind.MapperFeature.SORT_PROPERTIES_ALPHABETICALLY
6+
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
7+
import org.junit.Ignore
8+
import org.junit.Test
9+
import kotlin.test.assertEquals
10+
11+
class TestGitHub337 {
12+
private val mapper = jacksonObjectMapper()
13+
.setSerializationInclusion(JsonInclude.Include.ALWAYS)
14+
.configure(SORT_PROPERTIES_ALPHABETICALLY, true)
15+
private val writer = mapper.writerWithDefaultPrettyPrinter()
16+
17+
@Test
18+
@Ignore
19+
fun test_ClassWithIsFields() {
20+
data class ClassWithIsFields(
21+
val isBooleanField: Boolean,
22+
val isIntField: Int
23+
)
24+
25+
val problematic = ClassWithIsFields(true, 9)
26+
val expected = """
27+
{
28+
"isBooleanField" : true,
29+
"isIntField" : 9
30+
}""".trimIndent()
31+
assertEquals(expected, writer.writeValueAsString(problematic))
32+
}
33+
34+
@Test
35+
@Ignore
36+
fun test_AnnotatedClassWithIsFields() {
37+
data class ClassWithIsFields(
38+
@JsonProperty("isBooleanField") val isBooleanField: Boolean,
39+
@JsonProperty("isIntField") val isIntField: Int
40+
)
41+
42+
val problematic = ClassWithIsFields(true, 9)
43+
val expected = """
44+
{
45+
"isBooleanField" : true,
46+
"isIntField" : 9
47+
}""".trimIndent()
48+
assertEquals(expected, writer.writeValueAsString(problematic))
49+
}
50+
51+
@Test
52+
fun test_AnnotatedGetClassWithIsFields() {
53+
data class ClassWithIsFields(
54+
@JsonProperty("isBooleanField") val isBooleanField: Boolean,
55+
@get:JsonProperty("isIntField") val isIntField: Int
56+
)
57+
58+
val problematic = ClassWithIsFields(true, 9)
59+
val expected = """
60+
{
61+
"isBooleanField" : true,
62+
"isIntField" : 9
63+
}""".trimIndent()
64+
assertEquals(expected, writer.writeValueAsString(problematic))
65+
}
66+
}

0 commit comments

Comments
 (0)