-
-
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
881f920
commit 13a7490
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
45 changes: 45 additions & 0 deletions
45
src/test/java/com/fasterxml/jackson/databind/introspect/AutoDetect1947Test.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,45 @@ | ||
package com.fasterxml.jackson.databind.introspect; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
// Test(s) for [databind#1947], regression for 2.9 | ||
public class AutoDetect1947Test extends BaseMapTest | ||
{ | ||
static class Entity1947 { | ||
public int shouldBeDetected; | ||
public String shouldNotBeDetected; | ||
|
||
@JsonProperty | ||
public int getShouldBeDetected() { | ||
return shouldBeDetected; | ||
} | ||
|
||
public void setShouldBeDetected(int shouldBeDetected) { | ||
this.shouldBeDetected = shouldBeDetected; | ||
} | ||
|
||
public String getShouldNotBeDetected() { | ||
return shouldNotBeDetected; | ||
} | ||
|
||
public void setShouldNotBeDetected(String shouldNotBeDetected) { | ||
this.shouldNotBeDetected = shouldNotBeDetected; | ||
} | ||
} | ||
public void testDisablingAll() throws Exception | ||
{ | ||
ObjectMapper mapper = new ObjectMapper() | ||
.disable(MapperFeature.AUTO_DETECT_SETTERS) | ||
.disable(MapperFeature.AUTO_DETECT_FIELDS) | ||
.disable(MapperFeature.AUTO_DETECT_GETTERS) | ||
.disable(MapperFeature.AUTO_DETECT_CREATORS) | ||
.disable(MapperFeature.AUTO_DETECT_IS_GETTERS); | ||
String json = mapper.writeValueAsString(new Entity1947()); | ||
JsonNode n = mapper.readTree(json); | ||
assertEquals(1, n.size()); | ||
assertTrue(n.has("shouldBeDetected")); | ||
assertFalse(n.has("shouldNotBeDetected")); | ||
} | ||
} |