TiffAsJpegImporter implements ImageImporter { @Override public BatchItemObject consume(FileSet fileSet, ImportOptions ctx) { FileEntry jpegEntry = findJpeg(fileSet); if (jpegEntry == null) { return null; } try { FileEntry tiff; if (jpegEntry.getFile().length() > SMALL_IMAGE_SIZE_LIMIT) { tiff = convertToTiff(jpegEntry, ctx.getConfig().getConvertorJpgLargeProcessor()); } else { tiff = convertToTiff(jpegEntry, ctx.getConfig().getConvertorJpgSmallProcessor()); } if (tiff == null) { return null; } fileSet.getFiles().add(tiff); return importer.consume(fileSet, ctx); } catch (IOException ex) { LOG.log(Level.SEVERE, jpegEntry.toString(), ex); } return null; } TiffAsJpegImporter(TiffImporter importer); @Override boolean accept(FileSet fileSet); @Override BatchItemObject consume(FileSet fileSet, ImportOptions ctx);  }
@Test public void testConsumeInvalidFileSet() throws Exception { TiffAsJpegImporter importer = new TiffAsJpegImporter(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); }