public boolean isCompatibleWith(String runtimePluginApiVersion) {
    if (null == this.minimalSonarPluginApiVersion) {
      // no constraint defined on the plugin
      return true;
    }

    Version effectiveMin = Version.create(minimalSonarPluginApiVersion.getName()).removeQualifier();
    Version effectiveVersion = Version.create(runtimePluginApiVersion).removeQualifier();

    if (runtimePluginApiVersion.endsWith("-SNAPSHOT")) {
      // check only the major and minor versions (two first fields)
      effectiveMin = Version.create(effectiveMin.getMajor() + "." + effectiveMin.getMinor());
    }

    return effectiveVersion.compareTo(effectiveMin) >= 0;
  }
@Test
  public void test_compatibility_with_release_version_of_sonarqube() {
    // plugins compatible with 5.6 LTS
    assertThat(withMinSqVersion("5.6").isCompatibleWith("6.3.0.5000")).isTrue();
    assertThat(withMinSqVersion("5.6.1").isCompatibleWith("6.3.0.5000")).isTrue();

    // plugin build with old release candidates of SonarQube (RC technical versions have been removed
    // in SonarQube 6.3)
    assertThat(withMinSqVersion("5.6-RC1").isCompatibleWith("6.3.0.5000")).isTrue();
    assertThat(withMinSqVersion("6.2-RC1").isCompatibleWith("6.3.0.5000")).isTrue();

    // plugin built with snapshot version of SonarQube
    assertThat(withMinSqVersion("5.6-SNAPSHOT").isCompatibleWith("6.3.0.5000")).isTrue();
    assertThat(withMinSqVersion("6.3-SNAPSHOT").isCompatibleWith("6.3.0.5000")).isTrue();
    assertThat(withMinSqVersion("6.3-SNAPSHOT").isCompatibleWith("6.3.1.6000")).isTrue();
    assertThat(withMinSqVersion("6.4-SNAPSHOT").isCompatibleWith("6.3.0.5000")).isFalse();

    // plugin built with SonarQube releases
    assertThat(withMinSqVersion("6.3.0.5000").isCompatibleWith("6.3.0.4000")).isFalse();
    assertThat(withMinSqVersion("6.3.0.5000").isCompatibleWith("6.3.0.5000")).isTrue();
    assertThat(withMinSqVersion("6.3.0.5000").isCompatibleWith("6.3.1.6000")).isTrue();
    assertThat(withMinSqVersion("6.4.0.7000").isCompatibleWith("6.3.0.5000")).isFalse();

    // no constraint
    assertThat(withMinSqVersion(null).isCompatibleWith("6.3.0.5000")).isTrue();
  }