@Test public void testCreateIndexWhenDocDirDoesNotExistShouldLogError() { given(fileFactory.createFile(FOLDER_PATH)).willReturn(mockFolder); underTest.createIndex(FOLDER_PATH); verify(logger).error(Mockito.anyString()); }
public void createIndex(final String docsPath) { final File docDir = fileFactory.createFile(docsPath); if (!docDir.exists() || !docDir.canRead()) { logger.error("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); } else { indexFolder(docDir); } }
LuceneIndexEngine { public void createIndex(final String docsPath) { final File docDir = fileFactory.createFile(docsPath); if (!docDir.exists() || !docDir.canRead()) { logger.error("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); } else { indexFolder(docDir); } } }
LuceneIndexEngine { public void createIndex(final String docsPath) { final File docDir = fileFactory.createFile(docsPath); if (!docDir.exists() || !docDir.canRead()) { logger.error("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); } else { indexFolder(docDir); } }  }
LuceneIndexEngine { public void createIndex(final String docsPath) { final File docDir = fileFactory.createFile(docsPath); if (!docDir.exists() || !docDir.canRead()) { logger.error("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); } else { indexFolder(docDir); } }  void createIndex(final String docsPath); void addFileToIndex(final String fileName); }
LuceneIndexEngine { public void createIndex(final String docsPath) { final File docDir = fileFactory.createFile(docsPath); if (!docDir.exists() || !docDir.canRead()) { logger.error("Document directory '" + docDir.getAbsolutePath() + "' does not exist or is not readable, please check the path"); } else { indexFolder(docDir); } }  void createIndex(final String docsPath); void addFileToIndex(final String fileName);  }