StringConsumerExceptionHandler implements ExceptionHandler<StringEvent> { @Override public void handleEventException(Throwable ex, long sequence, StringEvent event) { if (event != null) { SynchronizingSelfLog.error( "AsyncConsumer occurs exception during handle StringEvent, The string is[" + event.getString() + "]", ex); } else { SynchronizingSelfLog.error( "AsyncConsumer occurs exception during handle StringEvent, The string is null", ex); } }  @Override void handleEventException(Throwable ex, long sequence, StringEvent event); @Override void handleOnStartException(Throwable ex); @Override void handleOnShutdownException(Throwable ex);  }
@Test public void handleEventExceptionWithEventNull() throws IOException, InterruptedException { stringConsumerExceptionHandler.handleEventException(new Throwable(), 2, null); Assert.assertTrue(checkFileContainError()); }
@Test public void handleEventExceptionWithEventNotNull() throws IOException, InterruptedException { stringConsumerExceptionHandler.handleEventException(new Throwable(), 2, stringEvent); Assert.assertTrue(checkFileContainError()); }