AvroValueEncoder { byte[] encode(GenericRecord record) { byte[] bytes = null; try { buffer.write(MAGIC_BYTE); buffer.write(Ints.toByteArray(version)); writer.write(record, encoder); encoder.flush(); bytes = buffer.toByteArray(); buffer.reset(); } catch (IOException unreachable) {} return bytes; } AvroValueEncoder(SchemaVersion schemaVersion);   }
@Test public void encodeTwo() throws Exception { Record record = new Record(schema); record.put("f", "f1"); byte[] result1 = underTest.encode(record); record.put("f", "f2"); byte[] result2 = underTest.encode(record); assertRecord(result1, "f1"); assertRecord(result2, "f2"); }