Skip to content

Commit

Permalink
Add first test for #1327; passes with 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 16, 2016
1 parent 0aa6486 commit e979bc5
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ static class NonEmptyDouble {

public NonEmptyDouble(double v) { value = v; }
}


@JsonInclude(JsonInclude.Include.NON_EMPTY)
public static class Issues1327Bean {
public String myString = "stuff";
public List<String> myList = new ArrayList<String>();
}

/*
/**********************************************************
/* Unit tests
Expand Down Expand Up @@ -231,4 +237,16 @@ public void testEmptyInclusionScalars() throws IOException
assertEquals("{\"i\":0}", defMapper.writeValueAsString(zero));
assertEquals("{\"i\":0}", inclMapper.writeValueAsString(zero));
}

public void testIssue1327() throws Exception {
ObjectMapper om = new ObjectMapper();
om.setSerializationInclusion(JsonInclude.Include.NON_NULL);

final Issues1327Bean input = new Issues1327Bean();
final String jsonString = om.writeValueAsString(input);

if (jsonString.contains("myList")) {
fail("Should not contain `myList`: "+jsonString);
}
}
}

0 comments on commit e979bc5

Please sign in to comment.