YamlRecordMarshaller implements RecordMarshaller<P, String> { @Override public YamlRecord processRecord(Record<P> record) throws Exception { StringWriter stringWriter = new StringWriter(); YamlWriter yamlWriter = new YamlWriter(stringWriter); yamlWriter.write(record.getPayload()); yamlWriter.close(); return new YamlRecord(record.getHeader(), stringWriter.toString()); }  @Override YamlRecord processRecord(Record<P> record);  }
@Test public void processRecord() throws Exception { YamlRecord yamlRecord = recordMarshaller.processRecord(record); assertThat(yamlRecord.getPayload()).isEqualTo("!org.jeasy.batch.extensions.yaml.Contact" + LINE_SEPARATOR + "name: foo" + LINE_SEPARATOR + "age: 10" + LINE_SEPARATOR); }