BaseEventAdviceDelegate implements EventAdviceDelegate { @Override public void fail(Object[] arguments, Throwable throwable) { if (eventRecorder != null && eventRecorder.isRecordEventEnabled()) { ErrorEventBuilder builder = new ErrorEventBuilder(); builder.setAssertion(AssertionExtractor.getAssertion(arguments)); builder.setThrowable(throwable); createAndRecordEvent(builder); } }  @Autowired void setEventRecorder(EventRecorder eventRecorder); @Autowired void setMessageRoutingAccessor(MessageRoutingAccessor messageRoutingAccessor); @Override EventDescription begin(Object[] args, String serviceType, String version,
        Class<? extends EventDescriptionBuilder> eventDescriptionbuilderClass); @Override void end(Object[] args, String serviceType, String version,
        Class<? extends EventDescriptionBuilder> eventDescriptionbuilderClass, Object returnValue); @Override void fail(Object[] arguments, Throwable throwable);  }
@Test public void failNoEventRecorder() { BaseEventAdviceDelegate delegate = createAdviceDelegate(null); delegate.fail(new Object[] {}, mock(Throwable.class)); }
@Test public void failShouldntCallRecordIfEventRecorderNotEnabled() { EventRecorder mockEventRecorder = mock(EventRecorder.class); BaseEventAdviceDelegate delegate = createAdviceDelegate(mockEventRecorder); delegate.fail(new Object[] {}, mock(Throwable.class)); assertEventRecorderInteractions(mockEventRecorder); }