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);  }
@Test public void testCreateIndexWhenDocDirDoesNotExistShouldLogError() { given(fileFactory.createFile(FOLDER_PATH)).willReturn(mockFolder); underTest.createIndex(FOLDER_PATH); verify(logger).error(Mockito.anyString()); }
@Test public void testCreateIndexWhenDocDirCannotBeReadShouldLogError() { given(mockFolder.exists()).willReturn(true); given(fileFactory.createFile(FOLDER_PATH)).willReturn(mockFolder); underTest.createIndex(FOLDER_PATH); verify(logger).error(Mockito.anyString()); }