### Question:
TiffToPDFConverter { public int convert(String rootDir, String barcode, String pdfName, AppContext appContext, Downloader downloader, String rootUrl, DLIDownloader adminData, Rectangle pageSize, LogWindow logWindow) throws IOException, DocumentException, CancelledExecutionException { int failures = 0; if (appContext.isShutdown()) { logger.info("Conversion cancelled due to shutdown in progress."); logWindow.log("Conversion cancelled due to shutdown in progress."); return failures; } Path directory = Paths.get(rootDir, barcode); logger.info("Converting directory to PDF " + directory); logWindow.log("Converting directory to PDF " + directory); List<Path> allTiffFiles = new ArrayList<>(); try (DirectoryStream<Path> ds = Files.newDirectoryStream(directory, entry -> entry.getFileName().toString().toLowerCase().endsWith(".tif") || entry.getFileName().toString().toLowerCase().endsWith(".tiff"))) { for (Path path : ds) {allTiffFiles.add(path);} Collections.sort(allTiffFiles, (first, second) -> first.getFileName().compareTo(second.getFileName())); Document document = new Document(pageSize); OutputStream os = Files.newOutputStream(Paths.get(rootDir, pdfName)); PdfWriter pdfWriter = PdfWriter.getInstance(document, os); pdfWriter.setStrictImageSequence(true); document.open(); if (appContext.isCreateBarcodePage()) { logWindow.log("Adding metadata to the output PDF"); try { addMetaData(barcode, adminData, document, pdfWriter, pageSize); logWindow.log("Added metadata page.."); } catch (Exception e) { logWindow.log("Exception adding metadata to page.." + e.getMessage()); } } else { logWindow.log("Skipping addition of Metadata Page."); } int count = 0; List<String> failedTiffs = new ArrayList<>(); for (Path path : allTiffFiles) { if (Thread.currentThread().isInterrupted()) { throw new CancelledExecutionException("Execution Cancelled, quiting PDF conversion"); } int failureCount = 0; AtomicBoolean status = new AtomicBoolean(false); while (!addTiffToDocument(document, path, pageSize, logWindow, status) && failureCount < appContext.getMaxConsecutiveIOFailure()) { try { ++failureCount; logger.info("pdf conversion failed, retrying download for tiff : " + path); logWindow.log("pdf conversion failed, retrying download for tiff : " + path); downloader.download(rootUrl, path.getFileName().toString(), directory.toAbsolutePath().toString(), appContext, true, logWindow, 1 << 23, true); } catch (Exception e) { logWindow.log("retry download failed for tiff : " + path); logger.info("retry download failed for tiff : " + path); appContext.getTap().pauseIfDisconnected(); } } if(!status.get()){ failedTiffs.add(path.toString()); } count++; } document.close(); os.close(); pdfWriter.close(); logger.warn("No. of Failed TIFF Conversions : " + failedTiffs); logWindow.log("No. of Failed TIFF Conversions : " + failedTiffs); logger.info("Tiff Images [" + count + "] Converted to PDF, PDF Generated : " + pdfName); logWindow.log("Tiff Images [" + count + "] Converted to PDF, PDF Generated : " + pdfName); } return failures; }  int convert(String rootDir, String barcode, String pdfName, AppContext appContext, Downloader downloader, String rootUrl, DLIDownloader adminData, Rectangle pageSize, LogWindow logWindow);  }### Answer:
@Test @Ignore public void testConvert() throws Exception { TiffToPDFConverter pdfConverter = new TiffToPDFConverter(); }