@Test
  public void badInputTest() throws Exception {
    refreshState(false, true, false);
    // compaction range contains a log segment that is still in the journal
    LogSegmentName firstLogSegmentName = state.referenceIndex.firstKey().getName();
    LogSegmentName secondLogSegmentName = state.log.getNextSegment(state.log.getSegment(firstLogSegmentName)).getName();
    LogSegmentName lastLogSegmentName = state.referenceIndex.lastKey().getName();
    CompactionDetails details = new CompactionDetails(state.time.milliseconds() + Time.MsPerSec,
        Arrays.asList(firstLogSegmentName, lastLogSegmentName), null);
    ensureArgumentFailure(details, "Should have failed because compaction range contains offsets still in the journal");

    // compaction range contains segments in the wrong order
    details = new CompactionDetails(state.time.milliseconds() + Time.MsPerSec,
        Arrays.asList(secondLogSegmentName, firstLogSegmentName), null);
    ensureArgumentFailure(details, "Should have failed because segments are in the wrong order");

    // compaction contains segments that don't exist
    details = new CompactionDetails(0, Collections.singletonList(lastLogSegmentName.getNextPositionName()), null);
    ensureArgumentFailure(details, "Should have failed because compaction range contains offsets still in the journal");

    long requiredCount = state.log.getCapacityInBytes() / state.log.getSegmentCapacity();
    writeDataToMeetRequiredSegmentCount(requiredCount, null);
    LogSegmentName thirdLogSegmentName = state.log.getNextSegment(state.log.getSegment(secondLogSegmentName)).getName();
    // compaction range is not consecutive
    details = new CompactionDetails(state.time.milliseconds() + Time.MsPerSec,
        Arrays.asList(firstLogSegmentName, thirdLogSegmentName), null);
    ensureArgumentFailure(details, "Should have failed because segments are not consecutive");
  }
Tests APIs with bad input and ensures that they fail fast.
@throws Exception
ambry-store/src/test/java/com/github/ambry/store/BlobStoreCompactorTest.java