BaseEventAdviceDelegate implements EventAdviceDelegate { @Override public void end(Object[] args, String serviceType, String version, Class<? extends EventDescriptionBuilder> eventDescriptionbuilderClass, Object returnValue) { if (eventRecorder != null && eventRecorder.isRecordEventEnabled()) { EventDescriptionBuilder eventDescriptionBuilder = createAndInitializeEventDecriptionBuilder(args, createEventContextAccessor(serviceType, version), eventDescriptionbuilderClass, returnValue); createAndRecordEvent(getEndEventBuilder(eventDescriptionBuilder, args)); } }  @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 endNoEventRecorder() { BaseEventAdviceDelegate delegate = createAdviceDelegate(null); delegate.end(new Object[] {}, "", "", EventDescriptionBuilder.class, null); }
@Test public void endShouldntCallRecordIfEventRecorderNotEnabled() { EventRecorder mockEventRecorder = mock(EventRecorder.class); BaseEventAdviceDelegate delegate = createAdviceDelegate(mockEventRecorder); delegate.end(new Object[] {}, "", "", EventDescriptionBuilder.class, null); assertEventRecorderInteractions(mockEventRecorder); }