JerseyClientJsonParser implements Parser { @Override public <T> T parse(byte[] data, Type type) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JavaType javaType = mapper.constructType(type); try { return mapper.readValue(data, javaType); } catch (IOException e) { throw new ParseException("Unable to parse data.", e); } }  @Override String encode(Object object); @Override T parse(byte[] data, Type type);  }
@Test public void testParse() throws Exception { Parser p = new JerseyClientJsonParser(); Something expected = new Something("coffee"); Something actual = p.parse("{\"name\":\"coffee\"}".getBytes(), Something.class); assertEquals(actual, expected); }