Created
October 20, 2011 19:21
-
-
Save brianm/1302037 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Test | |
public void testBetterErrorMessage() throws Exception | |
{ | |
ObjectMapper mapper = new ObjectMapper(); | |
try { | |
mapper.writeValueAsString(new Thing()); | |
fail("should have raised an exception against a private class"); | |
} | |
catch (Exception e) { | |
assertThat(e.getMessage(), containsString("private")); | |
} | |
} | |
private static class Thing | |
{ | |
@JsonAnyGetter | |
public Map getProperties() | |
{ | |
HashMap map = new HashMap(); | |
map.put("a", "A"); | |
return map; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment