private void verifyMiddleRangeCompactionDetails(List<LogSegmentName> logSegments, double[] validPercentage,
      int[] expectedCandidateIndex) throws StoreException {
    // please make sure logSegments size is equal to validPercentage array size.
    assertEquals(logSegments.size(), validPercentage.length);

    NavigableMap<LogSegmentName, Long> validDataSize = new TreeMap<>();
    int i = 0;
    for (LogSegmentName logSegmentName : logSegments) {
      validDataSize.put(logSegmentName, (long) (blobStore.segmentCapacity * validPercentage[i]));
      i++;
    }

    List<LogSegmentName> expectedCandidate = null;
    if (expectedCandidateIndex != null) {
      expectedCandidate = new ArrayList<>();
      for (int index : expectedCandidateIndex) {
        expectedCandidate.add(logSegments.get(index));
      }
    }

    mockBlobStoreStats.validDataSizeByLogSegments = validDataSize;
    CompactionPolicyTest.verifyCompactionDetails(expectedCandidate == null ? null
            : new CompactionDetails(time.milliseconds() - messageRetentionTimeInMs, expectedCandidate, null), blobStore,
        compactionPolicy);
  }
Verify the CompactionDetails is as expected.
@param logSegments log segments not in journal
@param validPercentage for each log segment, the valid size percentage
@param expectedCandidateIndex the index of the expected log segment candidates
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/StatsBasedCompactionPolicyTest.java