public class LogFileTest {
static private void readWrite(LogEvents event, long seq, int tid, String filename, KeyExtent tablet, Mutation[] mutations, LogFileKey keyResult,
LogFileValue valueResult) throws IOException {
LogFileKey key = new LogFileKey();
key.event = event;
key.seq = seq;
key.tid = tid;
key.filename = filename;
key.tablet = tablet;
key.tserverSession = keyResult.tserverSession;
LogFileValue value = new LogFileValue();
value.mutations = mutations != null ? mutations : new Mutation[0];
DataOutputBuffer out = new DataOutputBuffer();
key.write(out);
value.write(out);
out.flush();
DataInputBuffer in = new DataInputBuffer();
in.reset(out.getData(), out.size());
keyResult.readFields(in);
valueResult.readFields(in);
assertTrue(key.compareTo(keyResult) == 0);
assertTrue(Arrays.equals(value.mutations, valueResult.mutations));
assertTrue(in.read() == -1);
}