-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec87cfc
commit 8846b47
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/test/java/com/fasterxml/jackson/failing/IsGetterRenaming2527Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.fasterxml.jackson.failing; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
// [databind#2527] Support Kotlin-style "is" properties | ||
public class IsGetterRenaming2527Test extends BaseMapTest | ||
{ | ||
static class POJO2527 { | ||
private boolean isEnabled; | ||
|
||
protected POJO2527() { } | ||
public POJO2527(boolean b) { | ||
isEnabled = b; | ||
} | ||
|
||
public boolean getEnabled() { return isEnabled; } | ||
public void setEnabled(boolean b) { isEnabled = b; } | ||
} | ||
|
||
private final ObjectMapper MAPPER = newJsonMapper(); | ||
|
||
public void testIsProperties() throws Exception | ||
{ | ||
POJO2527 input = new POJO2527(true); | ||
final String json = MAPPER.writeValueAsString(input); | ||
|
||
Map<?, ?> props = MAPPER.readValue(json, Map.class); | ||
assertEquals(Collections.singletonMap("isEnabled", Boolean.TRUE), | ||
props); | ||
|
||
POJO2527 output = MAPPER.readValue(json, POJO2527.class); | ||
assertEquals(input.isEnabled, output.isEnabled); | ||
} | ||
} |