Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
update release notes wrt #63
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 17, 2016
1 parent 0f168c8 commit b2ee278
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ natnan@github
Steve Metcalfe (steveme@github)
* Reported #58: Specific ordering of type information for polymorphic deserialization
(2.6.2)

Lucas Pouzac (lucaspouzac@github)

* Reported, constributed fix to #63: Revert back expansion of NON_EMPTY handling
(2.7.1)
5 changes: 5 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Project: jackson-module-afterburner
=== Releases ===
------------------------------------------------------------------------

2.7.1 (not yet released)

#63: Revert back expansion of NON_EMPTY handling
(reported by Lucas P)

2.7.0 (10-Jan-2016)

No changes since 2.6.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,35 @@

public class TestInclusionAnnotations extends AfterburnerTestBase
{
public class IntWrapper
static class IntWrapper
{
@JsonInclude(JsonInclude.Include.NON_NULL)
public Integer value;

public IntWrapper(Integer v) { value = v; }
}

public class NonEmptyIntWrapper {
static class NonEmptyIntWrapper {
private int value;
public NonEmptyIntWrapper(int v) { value = v; }
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public int getValue() { return value; }
}

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class NonEmptyIntWrapper2 {
static class NonEmptyIntWrapper2 {
public int value;
public NonEmptyIntWrapper2(int v) { value = v; }
}

// But whereas 'empty' should NOT include '0', 'default' for property should
static class NonDefaultIntWrapper {
private int value;
public NonDefaultIntWrapper(int v) { value = v; }
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public int getValue() { return value; }
}

public class NonEmptyStringWrapper {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String value;
Expand Down Expand Up @@ -77,24 +85,47 @@ public void testEmptyExclusion() throws Exception
{
ObjectMapper mapper = mapperWithModule();
String json;


json = mapper.writeValueAsString(new NonEmptyIntWrapper(3));
assertEquals("{\"value\":3}", json);
// as per [module-afterburner#63], ints should not have "empty" value
// (temporarily, for 2.6, they did have)
json = mapper.writeValueAsString(new NonEmptyIntWrapper(0));
assertEquals("{\"value\":0}", json);

json = mapper.writeValueAsString(new NonEmptyStringWrapper("x"));
assertEquals("{\"value\":\"x\"}", json);
json = mapper.writeValueAsString(new NonEmptyStringWrapper(""));
assertEquals("{}", json);
json = mapper.writeValueAsString(new NonEmptyStringWrapper(null));
assertEquals("{}", json);
}

public void testEmptyExclusionViaClass() throws Exception
{
ObjectMapper mapper = mapperWithModule();

assertEquals("{\"value\":3}",
mapper.writeValueAsString(new NonEmptyIntWrapper2(3)));
assertEquals("{\"value\":0}",
mapper.writeValueAsString(new NonEmptyIntWrapper2(0)));

assertEquals("{\"value\":\"x\"}",
mapper.writeValueAsString(new NonEmptyStringWrapper2("x")));
assertEquals("{}",
mapper.writeValueAsString(new NonEmptyStringWrapper2("")));
assertEquals("{}",
mapper.writeValueAsString(new NonEmptyStringWrapper2(null)));
}

public void testDefaultExclusion() throws Exception
{
ObjectMapper mapper = mapperWithModule();
String json;

json = mapper.writeValueAsString(new NonDefaultIntWrapper(3));
assertEquals("{\"value\":3}", json);
json = mapper.writeValueAsString(new NonDefaultIntWrapper(0));
assertEquals("{}", json);
}
}

0 comments on commit b2ee278

Please sign in to comment.