TiffAsJp2Importer implements ImageImporter { @Override public BatchItemObject consume(FileSet fileSet, ImportOptions ctx) { FileEntry jp2Entry = findJp2(fileSet); if (jp2Entry == null) { return null; } try { FileEntry tiff = convertToTiff(jp2Entry, ctx.getConfig().getConvertorJp2Processor()); if (tiff == null) { return null; } fileSet.getFiles().add(tiff); return importer.consume(fileSet, ctx); } catch (IOException ex) { LOG.log(Level.SEVERE, jp2Entry.toString(), ex); } return null; } TiffAsJp2Importer(TiffImporter importer); @Override boolean accept(FileSet fileSet); @Override BatchItemObject consume(FileSet fileSet, ImportOptions ctx);  }
@Test public void testConsumeInvalidFileSet() throws Exception { TiffAsJp2Importer importer = new TiffAsJp2Importer(null); File testfile = new File(temp.getRoot(), "test.db"); FileSet set = new FileSet("test"); testfile.createNewFile(); assertTrue(testfile.exists()); assertNotNull(importer); set.getFiles().add(new FileSet.FileEntry(testfile)); ImportBatchManager.BatchItemObject object = importer.consume(set, null); assertNull(object); }