### Question:
HiveOutputFormatter implements OutputFormatter { @Override public byte[] formatRecord(Record record) { Map<String, Entry> entries = new HashMap<String, Entry>(); for (Entry value : record) { entries.put(value.getLabel(), value); } StringBuilder builder = new StringBuilder(); for (String header : orderedHeaders) { Entry value = entries.get(header); if (value != null) { builder.append(value.getValue().replaceAll(String.valueOf(fieldSeparator), "")); } builder.append(fieldSeparator); } return builder.substring(0, builder.length() - 1).getBytes(); } HiveOutputFormatter(List<String> orderedHeaders); void setFieldSeparator(final char fieldSeparator); @Override byte[] formatRecord(Record record);  }### Answer:
@Test public void testOutput() { byte[] output = formatter.formatRecord(record); byte[] expectedOutput = new String("val2long\tval1").getBytes(); assertEquals(expectedOutput.length, output.length); for (int i = 0; i < expectedOutput.length; i++) { assertEquals(expectedOutput[i], output[i]); } }