-
-
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
4a8c637
commit cb6dddd
Showing
9 changed files
with
76 additions
and
98 deletions.
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
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
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
32 changes: 32 additions & 0 deletions
32
src/test/java/com/fasterxml/jackson/databind/introspect/TransientFieldTest.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,32 @@ | ||
package com.fasterxml.jackson.databind.introspect; | ||
|
||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
import com.fasterxml.jackson.databind.*; | ||
|
||
// tests for [databind#296] | ||
public class TransientFieldTest extends BaseMapTest | ||
{ | ||
@JsonPropertyOrder({ "x" }) | ||
static class ClassyTransient | ||
{ | ||
public transient int value = 3; | ||
|
||
public int getValue() { return value; } | ||
|
||
public int getX() { return 42; } | ||
} | ||
|
||
public void testTransientFieldHandling() throws Exception | ||
{ | ||
// default handling: remove transient field but do not propagate | ||
ObjectMapper m = objectMapper(); | ||
assertEquals(aposToQuotes("{'x':42,'value':3}"), | ||
m.writeValueAsString(new ClassyTransient())); | ||
|
||
// but may change that | ||
m = new ObjectMapper() | ||
.enable(MapperFeature.PROPAGATE_TRANSIENT_MARKER); | ||
assertEquals(aposToQuotes("{'x':42}"), | ||
m.writeValueAsString(new ClassyTransient())); | ||
} | ||
} |
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