public void testExtractCDXJobWithWarcfilesExcludeChecsum() throws Exception {
    warcJob = new ExtractCDXFromWarcJob(false);
    OutputStream os = new ByteArrayOutputStream();
    assertFalse("The to-be-generated file should not exist aforehand", TestInfo.CDX_FILE.exists());
    os = new FileOutputStream(TestInfo.CDX_FILE);
    warcBlaf.run(warcJob, os);
    os.close();
    List<ExceptionOccurrence> exceptions = warcJob.getExceptions();
    for (ExceptionOccurrence eo : exceptions) {
      System.out.println("Exception: " + eo.getException());
    }
    assertTrue(warcJob.getExceptions().isEmpty());

    System.out.println(FileUtils.readFile(TestInfo.CDX_FILE));
  }
 public void finish(OutputStream os) {
   if (askedBefore) {
     super.finish(os);
   } else {
     askedBefore = true;
   }
 }
 /** Verify that the job runs without problems and visits all relevant records. */
 public void testRun() throws IOException {
   warcJob =
       new ExtractCDXFromWarcJob() {
         public void processRecord(ArchiveRecord sar, OutputStream os) {
           super.processRecord(sar, new ByteArrayOutputStream());
           processed++;
         }
       };
   OutputStream os = new FileOutputStream(TestInfo.TEMP_FILE);
   warcBlaf.run(warcJob, os);
   os.close();
   Exception[] es = warcJob.getExceptionArray();
   printExceptions(es);
   assertEquals("No exceptions should be thrown", 0, es.length);
   assertEquals(
       "The correct number of records should be processed", TestInfo.NUM_RECORDS, processed);
 }