@Test public void defaultMapper() throws Exception { try (PatchSetSerializer serializer = new PatchSetSerializer()) { PatchSet patchSet = new PatchSet("road1", new ArrayList<>()); byte[] bytes = serializer.serialize("topic", patchSet); ObjectReader reader = new ObjectMapper().readerFor(PatchSet.class); assertThat(reader.readValue(bytes), is(patchSet)); } }
@Override public byte[] serialize(String topic, PatchSet patch) { try { return objectWriter.writeValueAsBytes(patch); } catch (JsonProcessingException e) { throw new RuntimeException(e); } }
PatchSetSerializer implements Serializer<PatchSet> { @Override public byte[] serialize(String topic, PatchSet patch) { try { return objectWriter.writeValueAsBytes(patch); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } }
PatchSetSerializer implements Serializer<PatchSet> { @Override public byte[] serialize(String topic, PatchSet patch) { try { return objectWriter.writeValueAsBytes(patch); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } PatchSetSerializer();  PatchSetSerializer(ObjectWriter objectWriter); }
PatchSetSerializer implements Serializer<PatchSet> { @Override public byte[] serialize(String topic, PatchSet patch) { try { return objectWriter.writeValueAsBytes(patch); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } PatchSetSerializer();  PatchSetSerializer(ObjectWriter objectWriter); @Override void configure(Map<String, ?> configs, boolean isKey); @Override byte[] serialize(String topic, PatchSet patch); @Override void close(); }
PatchSetSerializer implements Serializer<PatchSet> { @Override public byte[] serialize(String topic, PatchSet patch) { try { return objectWriter.writeValueAsBytes(patch); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } PatchSetSerializer();  PatchSetSerializer(ObjectWriter objectWriter); @Override void configure(Map<String, ?> configs, boolean isKey); @Override byte[] serialize(String topic, PatchSet patch); @Override void close();  }