EventUtils { public static Event getEventFromTransactionEvent(TransactionEventRecord transactionEventRecord) { if (transactionEventRecord instanceof Put) { return ((Put)transactionEventRecord).getEvent(); } return null; }  static Event getEventFromTransactionEvent(TransactionEventRecord transactionEventRecord);  }
@Test public void testPutEvent() { FlumeEvent event = new FlumeEvent(null, new byte[5]); Put put = new Put(1L, 1L, event); Event returnEvent = EventUtils.getEventFromTransactionEvent(put); Assert.assertNotNull(returnEvent); Assert.assertEquals(5, returnEvent.getBody().length); }
@Test public void testInvalidEvent() { Take take = new Take(1L, 1L); Event returnEvent = EventUtils.getEventFromTransactionEvent(take); Assert.assertNull(returnEvent); }