@Override
    public ExecuteContext before(ExecuteContext context) throws Exception {
        final Object rawEvent = context.getArguments()[0];
        if (rawEvent instanceof ContextClosedEvent) {
            tryShutdown((ContextClosedEvent) rawEvent);
        }
        return context;
    }
@Test
    public void before() throws Exception {
        final SpringCloseEventInterceptor springCloseEventInterceptor = new SpringCloseEventInterceptor();
        springCloseEventInterceptor.before(buildContext(new Object[]{"test"}));
        Mockito.verify(registryService, Mockito.times(0)).shutdown();
        springCloseEventInterceptor.before(buildContext(new Object[]{new ContextClosedEvent(Mockito.mock(
                AnnotationConfigApplicationContext.class))}));
        Mockito.verify(registryService, Mockito.times(0)).shutdown();
        springCloseEventInterceptor.before(buildContext(new Object[]{new ContextClosedEvent(Mockito.mock(
                ClassPathXmlApplicationContext.class))}));
        Mockito.verify(registryService, Mockito.times(1)).shutdown();
        springCloseEventInterceptor.after(buildContext(new Object[]{"test"}));
    }