/**
* Verification of [JACKSON-301]
*/
public void testHandlingOfUnrecognized() throws Exception
{
UnrecognizedPropertyException exc = null;
try {
new ObjectMapper().readValue("{\"bar\":3}", Bean.class);
} catch (UnrecognizedPropertyException e) {
exc = e;
}
if (exc == null) {
fail("Should have failed binding");
}
assertEquals("bar", exc.getPropertyName());
assertEquals(Bean.class, exc.getReferringClass());
// also: should get list of known properties
verifyException(exc, "propX");
}