### Question:
DirectEventDeliverer extends EventDeliverer<T> { @Override protected void deliverTo(final T subscriber, final Method method, final Object[] args) { final SafeFuture<Object> result = executeMethod(subscriber, method, args); if (result != null) { result.finish( () -> {}, error -> exceptionHandler.handleException(error, subscriber, method, args)); } } DirectEventDeliverer(
      final ChannelExceptionHandler exceptionHandler, final MetricsSystem metricsSystem);   }### Answer:
@Test void shouldInvokeMethod() throws Exception { deliverer.deliverTo(target, Runnable.class.getMethod("run"), new Object[0]); verify(target).run(); }
@Test void shouldNotifyExceptionHandlerWhenMethodThrowsException() throws Exception { final RuntimeException error = new RuntimeException("Nope"); doThrow(error).when(target).run(); final Method method = Runnable.class.getMethod("run"); deliverer.deliverTo(target, method, NO_ARGS); verify(target).run(); verify(exceptionHandler).handleException(error, target, method, NO_ARGS); verifyNoMoreInteractions(exceptionHandler); }
@Test void shouldNotifyExceptionHandlerWhenIllegalAccessExceptionOccurs() throws Exception { final ClassWithPrivateMethod target = new ClassWithPrivateMethod(); final Method method = ClassWithPrivateMethod.class.getDeclaredMethod("run"); final DirectEventDeliverer<ClassWithPrivateMethod> deliverer = new DirectEventDeliverer<>(exceptionHandler, new NoOpMetricsSystem()); deliverer.deliverTo(target, method, NO_ARGS); verify(exceptionHandler) .handleException(any(IllegalAccessException.class), eq(target), eq(method), eq(NO_ARGS)); verifyNoMoreInteractions(exceptionHandler); }