void isInterrupted(final Store store, final StoreFile.Writer writer) throws IOException {
   if (store.getHRegion().areWritesEnabled()) return;
   // Else cleanup.
   writer.close();
   store.getFileSystem().delete(writer.getPath(), false);
   throw new InterruptedIOException(
       "Aborting compaction of store "
           + store
           + " in region "
           + store.getHRegion()
           + " because user requested stop.");
 }
  private static StripeCompactor createCompactor(StoreFileWritersCapture writers, KeyValue[] input)
      throws Exception {
    Configuration conf = HBaseConfiguration.create();
    final Scanner scanner = new Scanner(input);

    // Create store mock that is satisfactory for compactor.
    HColumnDescriptor col = new HColumnDescriptor(NAME_OF_THINGS);
    ScanInfo si = new ScanInfo(col, Long.MAX_VALUE, 0, CellComparator.COMPARATOR);
    Store store = mock(Store.class);
    when(store.getFamily()).thenReturn(col);
    when(store.getScanInfo()).thenReturn(si);
    when(store.areWritesEnabled()).thenReturn(true);
    when(store.getFileSystem()).thenReturn(mock(FileSystem.class));
    when(store.getRegionInfo()).thenReturn(new HRegionInfo(TABLE_NAME));
    when(store.createWriterInTmp(
            anyLong(), any(Compression.Algorithm.class), anyBoolean(), anyBoolean(), anyBoolean()))
        .thenAnswer(writers);
    when(store.getComparator()).thenReturn(CellComparator.COMPARATOR);

    return new StripeCompactor(conf, store) {
      @Override
      protected InternalScanner createScanner(
          Store store,
          List<StoreFileScanner> scanners,
          long smallestReadPoint,
          long earliestPutTs,
          byte[] dropDeletesFromRow,
          byte[] dropDeletesToRow)
          throws IOException {
        return scanner;
      }

      @Override
      protected InternalScanner createScanner(
          Store store,
          List<StoreFileScanner> scanners,
          ScanType scanType,
          long smallestReadPoint,
          long earliestPutTs)
          throws IOException {
        return scanner;
      }
    };
  }