@Test
public void testVerifyIngests() throws Exception {

   PGETaskInstance pgeTask = createTestInstance();
   // Test case failure.
   AutoDetectProductCrawler pc = createMock(AutoDetectProductCrawler.class);
   IngestStatus failedIngestStatus = new IngestStatus() {
      @Override
      public String getMessage() {
         return "Ingest Failure";
      }
      @Override
      public File getProduct() {
         return new File("/tmp/dir1");
      }
      @Override
      public Result getResult() {
         return Result.FAILURE;
      }
   };
   expect(pc.getIngestStatus()).andReturn(
         Lists.newArrayList(failedIngestStatus));
   replay(pc);
   try {
      pgeTask.verifyIngests(pc);
      fail("Should have thrown");
   } catch (Exception e) { /* expect throw */ }
   verify(pc);
   // Test case warn failure of precondition, but success overall.
   pc = createMock(AutoDetectProductCrawler.class);
   IngestStatus precondsFailIngestStatus = new IngestStatus() {
      @Override
      public String getMessage() {
         return "Preconditions failed";
      }
      @Override
      public File getProduct() {
         return new File("/tmp/dir1");
      }
      @Override
      public Result getResult() {
         return Result.PRECONDS_FAILED;
      }
   };
   expect(pc.getIngestStatus()).andReturn(
         Lists.newArrayList(precondsFailIngestStatus));
   replay(pc);
   pgeTask.julLogger = createMock(Logger.class);
   pgeTask.julLogger.info("Verifying ingests successful...");
   pgeTask.julLogger.warning(
         "Product was not ingested [file='/tmp/dir1',result='PRECONDS_FAILED',msg='Preconditions failed']");
   pgeTask.julLogger.info("Ingests were successful");
   replay(pgeTask.julLogger);
   pgeTask.verifyIngests(pc);
   verify(pc);
   verify(pgeTask.julLogger);
   // Test case success.
   pc = createMock(AutoDetectProductCrawler.class);
   IngestStatus successIngestStatus = new IngestStatus() {
      @Override
      public String getMessage() {
         return "Ingest Success";
      }
      @Override
      public File getProduct() {
         return new File("/tmp/dir1");
      }
      @Override
      public Result getResult() {
         return Result.SUCCESS;
      }
   };
   expect(pc.getIngestStatus()).andReturn(
         Lists.newArrayList(successIngestStatus));
   replay(pc);
   pgeTask.julLogger = createMock(Logger.class);
   pgeTask.julLogger.info("Verifying ingests successful...");
   pgeTask.julLogger.info("Ingests were successful");
   replay(pgeTask.julLogger);
   pgeTask.verifyIngests(pc);
   verify(pc);
   verify(pgeTask.julLogger);
}