@Test
public void testBuildOfJacksonWithInvalidType() throws Exception {

    String badDocument = "{\"value\":\"notANumber\"}";
    List<ErrorResponses.StackTraceRepresentation> mappedError = null;
    try {
        mapper.readValue(badDocument, MyService.class);
        fail("Expected parsing exception");
    } catch (InvalidFormatException e) {
        mappedError = ErrorResponses.buildExceptionContext(e);
    }
    Map<String, Object> details = mappedError.get(0).getDetails();
    assertThat(details, is(notNullValue()));
    assertThat(details.get("pathReference"), is(equalTo(this.getClass().getName() + "$MyService[\"value\"]")));
    assertThat(details.get("targetType"), is(equalTo("int")));
    assertThat((String) details.get("errorLocation"), containsString("line: 1"));
    assertThat(details.get("document"), is(equalTo("{\"value\":\"notANumber\"}")));
}