Skip to content

Commit 141f7c8

Browse files
committed
Merge remote-tracking branch 'origin/2.13'
2 parents 66f3be9 + 689e8cc commit 141f7c8

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,39 @@
177177
<groupId>de.jjohannes</groupId>
178178
<artifactId>gradle-module-metadata-maven-plugin</artifactId>
179179
</plugin>
180+
181+
<plugin>
182+
<groupId>com.github.siom79.japicmp</groupId>
183+
<artifactId>japicmp-maven-plugin</artifactId>
184+
<version>0.15.3</version>
185+
<configuration>
186+
<oldVersion>
187+
<dependency>
188+
<groupId>com.fasterxml.jackson.module</groupId>
189+
<artifactId>jackson-module-kotlin</artifactId>
190+
<version>2.12.2</version>
191+
<type>jar</type>
192+
</dependency>
193+
</oldVersion>
194+
<newVersion>
195+
<file>
196+
<path>${project.build.directory}/${project.artifactId}-${project.version}.jar</path>
197+
</file>
198+
</newVersion>
199+
<parameter>
200+
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
201+
<breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
202+
</parameter>
203+
</configuration>
204+
<executions>
205+
<execution>
206+
<phase>verify</phase>
207+
<goals>
208+
<goal>cmp</goal>
209+
</goals>
210+
</execution>
211+
</executions>
212+
</plugin>
180213
</plugins>
181214
</build>
182215

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import org.junit.Test
66
import kotlin.test.assertEquals
77

88
class TestGithub80 {
9-
109
@Test
1110
fun testIsBool() {
1211
val mapper = jacksonObjectMapper()
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
/**
12+
* Fields named "is…" are only serialized if they are Boolean
13+
*/
14+
class TestGitHub337 {
15+
private val mapper = jacksonObjectMapper()
16+
.setSerializationInclusion(JsonInclude.Include.ALWAYS)
17+
.configure(SORT_PROPERTIES_ALPHABETICALLY, true)
18+
private val writer = mapper.writerWithDefaultPrettyPrinter()
19+
20+
@Test
21+
@Ignore
22+
fun test_ClassWithIsFields() {
23+
data class ClassWithIsFields(
24+
val isBooleanField: Boolean,
25+
val isIntField: Int
26+
)
27+
28+
val problematic = ClassWithIsFields(true, 9)
29+
val expected = """
30+
{
31+
"isBooleanField" : true,
32+
"isIntField" : 9
33+
}""".trimIndent()
34+
assertEquals(expected, writer.writeValueAsString(problematic))
35+
}
36+
37+
@Test
38+
@Ignore
39+
fun test_AnnotatedClassWithIsFields() {
40+
data class ClassWithIsFields(
41+
@JsonProperty("isBooleanField") val isBooleanField: Boolean,
42+
@JsonProperty("isIntField") val isIntField: Int
43+
)
44+
45+
val problematic = ClassWithIsFields(true, 9)
46+
val expected = """
47+
{
48+
"isBooleanField" : true,
49+
"isIntField" : 9
50+
}""".trimIndent()
51+
assertEquals(expected, writer.writeValueAsString(problematic))
52+
}
53+
54+
@Test
55+
fun test_AnnotatedGetClassWithIsFields() {
56+
data class ClassWithIsFields(
57+
@JsonProperty("isBooleanField") val isBooleanField: Boolean,
58+
@get:JsonProperty("isIntField") val isIntField: Int
59+
)
60+
61+
val problematic = ClassWithIsFields(true, 9)
62+
val expected = """
63+
{
64+
"isBooleanField" : true,
65+
"isIntField" : 9
66+
}""".trimIndent()
67+
assertEquals(expected, writer.writeValueAsString(problematic))
68+
}
69+
}

0 commit comments

Comments
 (0)