FixedLengthRecordMarshaller implements RecordMarshaller<P, String> { @Override public StringRecord processRecord(final Record<P> record) throws Exception { Header header = record.getHeader(); Object[] fields = toArray(fieldExtractor.extractFields(record.getPayload())); String payload = String.format(locale, format, fields); return new StringRecord(header, payload); } FixedLengthRecordMarshaller(final Class<P> type, String format, final String... fields);  FixedLengthRecordMarshaller(FieldExtractor<P> fieldExtractor, String format); @Override StringRecord processRecord(final Record<P> record); void setLocale(Locale locale);  }
@Test public void marshal() throws Exception { String expectedPayload = "aaabb ccdddd"; StringRecord actual = marshaller.processRecord(record); assertThat(actual.getHeader()).isEqualTo(header); assertThat(actual.getPayload()).isEqualTo(expectedPayload); }