@EventListener(value = ContextClosedEvent.class)
    public void listener() {
        if (!isEnableGraceDown() || graceService == null) {
            return;
        }
        graceService.shutdown();
    }
@Test
    public void listener() {
        MockitoAnnotations.openMocks(this);
        final GraceConfig graceConfig = new GraceConfig();
        try (final MockedStatic<PluginServiceManager> pluginServiceManagerMockedStatic =
                Mockito.mockStatic(PluginServiceManager.class);
            final MockedStatic<PluginConfigManager> pluginConfigManagerMockedStatic = Mockito
                        .mockStatic(PluginConfigManager.class);) {
            pluginConfigManagerMockedStatic.when(() -> PluginConfigManager.getPluginConfig(GraceConfig.class))
                    .thenReturn(graceConfig);
            pluginServiceManagerMockedStatic.when(() -> PluginServiceManager.getPluginService(GraceService.class))
                    .thenReturn(graceService);
            final ContextClosedEventListener contextClosedEventListener = new ContextClosedEventListener();
            contextClosedEventListener.listener();
            Mockito.verify(graceService, Mockito.times(0)).shutdown();
            graceConfig.setEnableSpring(true);
            graceConfig.setEnableGraceShutdown(true);
            graceConfig.setEnableOfflineNotify(true);
            contextClosedEventListener.listener();
            Mockito.verify(graceService, Mockito.times(1)).shutdown();
        }
    }