### Question:
CachedDownloads { public synchronized void buildLocalIndex() { for (String dir : directories) { try { if (dir != null) { try { dir = dir.trim(); if (!dir.isEmpty() && Files.exists(Paths.get(dir))) { logger.info("Scanning directory [{}] for barcode - ", dir); AtomicInteger counter = new AtomicInteger(0); Files.walkFileTree(Paths.get(dir), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { final String filename = path.getFileName().toString(); if (filename.endsWith(".pdf")) { add(extractor.extractFromPdf(filename), path); counter.incrementAndGet(); } return CONTINUE; } }); logger.info("Total files processed from directory [{}] = {}", dir, counter.get()); } } catch (IOException e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } try { commitChanges(); } catch (IOException e) { e.printStackTrace(); } cacheReady = true; notifyAll(); } CachedDownloads(String directories, BarcodeExtractor extractor, AppContext appContext); synchronized void awaitCache(); synchronized void buildLocalIndex(); synchronized void add(String barcode, Path path); synchronized void commitChanges();  }### Answer:
@Test public void testCheckPresent() throws Exception { CachedDownloads cachedDownloads = new CachedDownloads("D:\\workspace\\DLIDownloader 2; d:\\dli 2", extractor, appContext); cachedDownloads.buildLocalIndex(); }
@Test public void testCheckPresentForBlankInput() throws Exception { CachedDownloads cachedDownloads = new CachedDownloads("", extractor, appContext); cachedDownloads.buildLocalIndex(); }
@Test public void testCheckPresentForNullInput() throws Exception { CachedDownloads cachedDownloads = new CachedDownloads(null, extractor, appContext); cachedDownloads.buildLocalIndex(); }
@Test public void testCheckPresentForWrongInput() throws Exception { CachedDownloads cachedDownloads = new CachedDownloads("null", extractor, appContext); cachedDownloads.buildLocalIndex(); }