public boolean evaluateIfActiveVersion(UpdateCenter updateCenter) {
    Version installedVersion = Version.create(sonarQubeVersion.get().toString());

    if (compareWithoutPatchVersion(installedVersion, updateCenter.getSonar().getLtaVersion().getVersion()) == 0) {
      return true;
    }
    SortedSet<Release> allReleases = updateCenter.getSonar().getAllReleases();
    if (compareWithoutPatchVersion(installedVersion, updateCenter.getSonar().getPastLtaVersion().getVersion()) == 0) {
      Release initialLtaRelease = findInitialVersionOfMajorRelease(allReleases, updateCenter.getSonar().getLtaVersion().getVersion());
      Date initialLtaReleaseDate = initialLtaRelease.getDate();
      if (initialLtaReleaseDate == null) {
        throw new IllegalStateException("Initial Major release date is missing in releases");
      }
      // date of the latest major release should be within 6 months
      Calendar c = Calendar.getInstance();
      c.setTime(new Date(system2.now()));
      c.add(Calendar.MONTH, -6);

      return initialLtaReleaseDate.after(c.getTime());
    } else {
      return compareWithoutPatchVersion(installedVersion, findPreviousReleaseIgnoringPatch(allReleases).getVersion()) >= 0;
    }
  }
@Test
  void evaluateIfActiveVersion_whenNoPreviousReleasesFound_shouldThrowIllegalStateException() {

    when(sonarQubeVersion.get()).thenReturn(parse("10.4.1"));
    TreeSet<Release> releases = new TreeSet<>();
    releases.add(new Release(sonar, Version.create("10.4.1")));
    when(sonar.getAllReleases()).thenReturn(releases);

    assertThatThrownBy(() -> underTest.evaluateIfActiveVersion(updateCenter))
      .isInstanceOf(IllegalStateException.class)
      .hasMessageContaining("Unable to find previous release in releases");
  }