@Test
  public void testDifferentUsedCapacities() throws StoreException {
    List<LogSegmentName> bestCandidates = null;
    if (compactionPolicy instanceof StatsBasedCompactionPolicy) {
      bestCandidates = setUpStateForStatsBasedCompactionPolicy(blobStore, mockBlobStoreStats);
    } else if (compactionPolicy instanceof CompactAllPolicy) {
      blobStore.logSegmentsNotInJournal = generateRandomLogSegmentName(3);
      bestCandidates = blobStore.logSegmentsNotInJournal;
    }

    // if used capacity is <= 60%, compaction details will be null. If not, logSegmentsNotInJournal needs to be returned.
    Long[] usedCapacities =
        new Long[]{CAPACITY_IN_BYTES * 2 / 10, (CAPACITY_IN_BYTES * 4 / 10), CAPACITY_IN_BYTES * 5 / 10,
            CAPACITY_IN_BYTES * 51 / 100, (CAPACITY_IN_BYTES * 6 / 10), CAPACITY_IN_BYTES * 7 / 10,
            CAPACITY_IN_BYTES * 9 / 10};
    for (Long usedCapacity : usedCapacities) {
      blobStore.usedCapacity = usedCapacity;
      if (blobStore.usedCapacity < (config.storeMinUsedCapacityToTriggerCompactionInPercentage / 100.0
          * blobStore.capacityInBytes)) {
        verifyCompactionDetails(null, blobStore, compactionPolicy);
      } else {
        verifyCompactionDetails(
            new CompactionDetails(time.milliseconds() - messageRetentionTimeInMs, bestCandidates, null), blobStore,
            compactionPolicy);
      }
    }
  }
Tests {@link CompactionManager#getCompactionDetails(BlobStore)} for different values for {@link BlobStore}'s
used capacity
@throws StoreException
ambry-store/src/test/java/com/github/ambry/store/CompactionPolicyTest.java