### Question:
F2SEventComparator implements Comparator<F2SEvent> { public int compare(F2SEvent e1, F2SEvent e2) { Preconditions.checkNotNull(e1, "Cannot compare null Flume2Storm events"); Preconditions.checkNotNull(e2, "Cannot compare null Flume2Storm events"); return ComparisonChain.start().compare(new String(e1.getBody()), new String(e2.getBody())).result(); }  int compare(F2SEvent e1, F2SEvent e2);  }### Answer:
@Test public void testSame() { byte[] body = "Test string".getBytes(); Map<String, String> headers = ImmutableMap.of("K1", "v1", "k2", "v2"); int res = new F2SEventComparator().compare(new F2SEvent(headers, body), new F2SEvent(headers, body)); Assert.assertTrue(res == 0); }
@Test public void testHeader() { Map<String, String> headers = ImmutableMap.of("K1", "v1", "k2", "v2"); int res = new F2SEventComparator().compare(new F2SEvent(headers, "1".getBytes()), new F2SEvent(headers, "2".getBytes())); Assert.assertTrue(res < 0); }