public void notify(PluginJarChangeListener listener, Collection<BundleOrPluginFileDetails> knowPluginFiles, Collection<BundleOrPluginFileDetails> currentPluginFiles) {
        List<BundleOrPluginFileDetails> oldPlugins = new ArrayList<>(knowPluginFiles);

        subtract(oldPlugins, currentPluginFiles).forEach(listener::pluginJarRemoved);

        currentPluginFiles.forEach(newPlugin -> {
            int index = oldPlugins.indexOf(newPlugin);
            if (index < 0) {
                listener.pluginJarAdded(newPlugin);
            } else if (newPlugin.doesTimeStampDiffer(oldPlugins.get(index))) {
                listener.pluginJarUpdated(newPlugin);
            }
        });
    }
@Test
    void shouldNotifyRemovedBeforeAddWhenPluginJarIsRenamed() {
        final PluginJarChangeListener listener = mock(PluginJarChangeListener.class);
        File pluginJarOne = mock(File.class);
        File pluginJarTwo = mock(File.class);
        File pluginWorkDir = mock(File.class);
        BundleOrPluginFileDetails pluginOne = new BundleOrPluginFileDetails(pluginJarOne, false, pluginWorkDir);
        BundleOrPluginFileDetails pluginTwo = new BundleOrPluginFileDetails(pluginJarTwo, false, pluginWorkDir);

        List<BundleOrPluginFileDetails> knownPlugins = List.of(pluginOne);
        List<BundleOrPluginFileDetails> newPlugins = List.of(pluginTwo);

        when(pluginJarOne.getName()).thenReturn("plugin-1.0.0.jar");
        when(pluginJarTwo.getName()).thenReturn("plugin-2.0.0.jar");

        pluginChangeNotifier.notify(listener, knownPlugins, newPlugins);

        InOrder inOrder = inOrder(listener);
        inOrder.verify(listener).pluginJarRemoved(pluginOne);
        inOrder.verify(listener).pluginJarAdded(pluginTwo);
        verify(listener, never()).pluginJarUpdated(any());
    }