boolean isCompatible(T plugin) {
    if (!Strings.isNullOrEmpty(plugin.getBasePlugin()) && !allPluginsByKeys.containsKey(plugin.getBasePlugin())) {
      // it extends a plugin that is not installed
      LOG.warn("Plugin {} [{}] is ignored because its base plugin [{}] is not installed", plugin.getName(), plugin.getKey(), plugin.getBasePlugin());
      return false;
    }

    for (PluginInfo.RequiredPlugin requiredPlugin : plugin.getRequiredPlugins()) {
      PluginInfo installedRequirement = allPluginsByKeys.get(requiredPlugin.getKey());
      if (installedRequirement == null) {
        // it requires a plugin that is not installed
        LOG.warn("Plugin {} [{}] is ignored because the required plugin [{}] is not installed", plugin.getName(), plugin.getKey(), requiredPlugin.getKey());
        return false;
      }
      Version installedRequirementVersion = installedRequirement.getVersion();
      if (installedRequirementVersion != null && requiredPlugin.getMinimalVersion().compareToIgnoreQualifier(installedRequirementVersion) > 0) {
        // it requires a more recent version
        LOG.warn("Plugin {} [{}] is ignored because the version {} of required plugin [{}] is not installed", plugin.getName(), plugin.getKey(),
            requiredPlugin.getMinimalVersion(), requiredPlugin.getKey());
        return false;
      }
    }
    return true;
  }
@Test
  public void isCompatible_verifies_base_plugin_existence() {
    PluginInfo pluginWithoutBase = new PluginInfo("plugin-without-base-plugin")
      .setBasePlugin("not-existing-base-plugin");
    PluginInfo basePlugin = new PluginInfo("base-plugin");
    PluginInfo pluginWithBase = new PluginInfo("plugin-with-base-plugin")
      .setBasePlugin("base-plugin");
    Map<String, PluginInfo> plugins = new HashMap<>();
    plugins.put(pluginWithoutBase.getKey(), pluginWithoutBase);
    plugins.put(basePlugin.getKey(), basePlugin);
    plugins.put(pluginWithBase.getKey(), pluginWithBase);

    var underTest = new PluginRequirementsValidator<>(plugins);

    assertThat(underTest.isCompatible(pluginWithoutBase)).isFalse();
    assertThat(underTest.isCompatible(pluginWithBase)).isTrue();
    assertThat(logTester.logs(Level.WARN))
      .contains("Plugin plugin-without-base-plugin [plugin-without-base-plugin] is ignored"
        + " because its base plugin [not-existing-base-plugin] is not installed");
  }