@Override
    public void pluginStateChanged(PluginStateEvent event) {
        var pluginState = event.getPluginState();
        String pluginId = event.getPlugin().getPluginId();
        if (pluginState == PluginState.UNLOADED) {
            entries.remove(pluginId);
        } else if (pluginState == PluginState.CREATED || pluginState == PluginState.RESOLVED) {
            entries.computeIfAbsent(pluginId, id -> readPluginStorage(event.getPlugin()));
        }
    }
@Test
    void shouldRemoveEntryIfPluginUnloaded() throws FileNotFoundException {
        var pluginWrapper = mockPluginWrapper();
        when(pluginWrapper.getPluginState()).thenReturn(PluginState.CREATED);

        var event = new PluginStateEvent(pluginManager, pluginWrapper, null);
        finder.pluginStateChanged(event);

        var classNames = finder.findClassNames("fake-plugin");
        assertFalse(classNames.isEmpty());

        when(pluginWrapper.getPluginState()).thenReturn(PluginState.UNLOADED);
        event = new PluginStateEvent(pluginManager, pluginWrapper, null);
        finder.pluginStateChanged(event);

        classNames = finder.findClassNames("fake-plugin");
        assertTrue(classNames.isEmpty());
    }