Skip to content

Commit

Permalink
Add (failing) test for #2527
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 27, 2019
1 parent ec87cfc commit 8846b47
Showing 1 changed file with 37 additions and 0 deletions.
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);
}
}

0 comments on commit 8846b47

Please sign in to comment.