ChannelUtils { public static void put(final Channel channel, final Event event) throws ChannelException { transact(channel, new Runnable() { @Override public void run() { channel.put(event); } }); } private  ChannelUtils(); static void put(final Channel channel, final Event event); static void put(final Channel channel, final Collection<Event> events); static Event take(final Channel channel); static List<Event> take(final Channel channel, final int max); static void transact(Channel channel, Runnable transactor); static T transact(Channel channel, Callable<T> transactor);  }
@Test public void testHappyPath1() { ChannelUtils.put(channel, events.get(0)); Assert.assertTrue(channel.wasLastTransactionCommitted()); Assert.assertFalse(channel.wasLastTransactionRolledBack()); Assert.assertTrue(channel.wasLastTransactionClosed()); }
@Test public void testInterrupt() throws Exception { testTransact(TestChannel.Mode.SLEEP, InterruptedException.class, new Runnable() { @Override public void run() { interruptTest(new Runnable() { @Override public void run() { channel.put(events.get(0)); } }); } }); }