@Test public void test_serialize_request_with_complex_arguments() { Tomato tomato = new Tomato(new TomatoCooking(), "red"); Pepper pepper = new Pepper(new TomatoCooking(), "spain"); DiagnosticRequest request = new DiagnosticRequest(Closeable.class, "prepareDiner()", tomato, pepper); assertThat(codec.serialize(request), is(equalTo(jsonFile("/output2.json")))); }
@Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); try { return objectMapper.writeValueAsString(o); } catch (JsonProcessingException | RuntimeException e) { throw new DiagnosticCodecException(e); } }
JsonDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); try { return objectMapper.writeValueAsString(o); } catch (JsonProcessingException | RuntimeException e) { throw new DiagnosticCodecException(e); } } }
JsonDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); try { return objectMapper.writeValueAsString(o); } catch (JsonProcessingException | RuntimeException e) { throw new DiagnosticCodecException(e); } } JsonDiagnosticCodec(ObjectMapperFactory objectMapperFactory); }
JsonDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); try { return objectMapper.writeValueAsString(o); } catch (JsonProcessingException | RuntimeException e) { throw new DiagnosticCodecException(e); } } JsonDiagnosticCodec(ObjectMapperFactory objectMapperFactory); @Override String serialize(Object o); @Override T deserialize(String json, Class<T> target); @Override String toString(); }
JsonDiagnosticCodec extends DiagnosticCodecSkeleton<String> { @Override public String serialize(Object o) throws DiagnosticCodecException { requireNonNull(o); try { return objectMapper.writeValueAsString(o); } catch (JsonProcessingException | RuntimeException e) { throw new DiagnosticCodecException(e); } } JsonDiagnosticCodec(ObjectMapperFactory objectMapperFactory); @Override String serialize(Object o); @Override T deserialize(String json, Class<T> target); @Override String toString();  }