JacksonDeserializer implements Deserializer<T> { @Override public T call(final RawJsonDocument document) { try { final String wrapped = join(START_OBJECT, document.content(), END_OBJECT); final BeanWrapper<T> bean = mapper.reader(reference).readValue(wrapped); return bean.getEntity(); } catch (final IOException e) { throw new JacksonConversionException("Error while deserializing document id=" + document.id(), e); } }  @Override T call(final RawJsonDocument document);  }
@Test(expected = JacksonConversionException.class) public void shouldNotDeserialize() throws JsonProcessingException, IOException { doThrow(new IOException()).when(reader).readValue(anyString()); final ReactiveEntity single = deserializer.call(serializedEntity); assertSame(single, entity); }
@Test public void shouldDeserialize() throws IOException { final ReactiveEntity single = deserializer.call(serializedEntity); assertSame(single, entity); verify(mapper).reader(reference); verify(reader) .readValue( JacksonDeserializer.START_OBJECT + serializedEntity.content() + JacksonDeserializer.END_OBJECT); }