@Override
    public void pluginJarAdded(BundleOrPluginFileDetails bundleOrPluginFileDetails) {
        final GoPluginBundleDescriptor bundleDescriptor = goPluginBundleDescriptorBuilder.build(bundleOrPluginFileDetails);

        try {
            LOGGER.info("Plugin load starting: {}", bundleOrPluginFileDetails.file());

            validateIfExternalPluginRemovingBundledPlugin(bundleDescriptor);
            validatePluginCompatibilityWithCurrentOS(bundleDescriptor);
            validatePluginCompatibilityWithGoCD(bundleDescriptor);
            addPlugin(bundleOrPluginFileDetails, bundleDescriptor);
        } finally {
            LOGGER.info("Plugin load finished: {}", bundleOrPluginFileDetails.file());
        }
    }
@Test
    void shouldOverwriteAFileCalledGoPluginActivatorInLibWithOurOwnGoPluginActivatorEvenIfItExists() throws Exception {
        File pluginJarFile = new File(pluginWorkDir, PLUGIN_JAR_FILE_NAME);
        File expectedBundleDirectory = new File(bundleDir, PLUGIN_JAR_FILE_NAME);
        File activatorFileLocation = new File(expectedBundleDirectory, "lib/go-plugin-activator.jar");
        FileUtils.writeStringToFile(activatorFileLocation, "SOME-DATA", UTF_8);

        copyPluginToTheDirectory(pluginWorkDir, PLUGIN_JAR_FILE_NAME);
        String pluginJarFileLocation = pluginJarFile.getAbsolutePath();
        GoPluginBundleDescriptor descriptor = new GoPluginBundleDescriptor(GoPluginDescriptor.builder()
                .id("testplugin.descriptorValidator")
                .bundleLocation(expectedBundleDirectory)
                .pluginJarFileLocation(pluginJarFileLocation)
                .isBundledPlugin(true)
                .build());
        when(goPluginBundleDescriptorBuilder.build(new BundleOrPluginFileDetails(pluginJarFile, true, pluginWorkDir))).thenReturn(descriptor);
        doNothing().when(registry).loadPlugin(descriptor);

        listener.pluginJarAdded(new BundleOrPluginFileDetails(pluginJarFile, true, pluginWorkDir));

        assertThat(new File(expectedBundleDirectory, "lib/go-plugin-activator.jar")).exists();
        assertThat(FileUtils.readFileToString(activatorFileLocation, UTF_8)).isNotEqualTo("SOME-DATA");
    }