### Question:
LogFiles { Collection<File> resolveLogFiles() throws IOException { File logDir = getLogfileDirectory(); Collection<File> logFiles = new TreeSet<>((o1, o2) -> o1.getPath().compareToIgnoreCase(o2.getPath())); if (logDir == null) { logDir = new File(this.slingHomeDirectory, "logs"); } if (logDir.exists() && logDir.isDirectory()) { logFiles.addAll(listFiles(logDir, LOGFILE_FILTER, TrueFileFilter.INSTANCE)); } for (File logFile : resolveFactoryConfiguredLogFiles()) { if (!logFile.getParentFile().getAbsolutePath().startsWith(logDir.getAbsolutePath())) { logFiles.addAll(listFiles(logFile.getParentFile(), LOGFILE_FILTER, TrueFileFilter.INSTANCE)); } } return logFiles; }    }### Answer:
@Test public void testAdditionalLogFilesConfiguration() throws Exception { withAdditionalLogfile("remote-logs/error.log"); assertThat(resolveLogFiles()) .contains(file("remote-logs/error.log")); }
@Test public void testFallBackToDefaultLogsLocationIfNoConfigurationExists() throws Exception { withNonexistentLoggingConfiguration(); assertThat(resolveLogFiles()) .contains( file("logs/crx/error.log"), file("logs/crx/error.log.0"), file("logs/crx/error.log.2020-11-23"), file("logs/error-withwhitespaces.log"), file("logs/error.log"), file("logs/error.log.1"), file("logs/error.log.2020-01-01")); }
@Test(expected = IllegalStateException.class) public void testHandlingOfConfigurationRetrievalFailure() throws Exception { withInvalidConfigurationQuerySyntax(); resolveLogFiles(); }
@Test public void testMissingSlingLogConfigurationIsTolerated() throws Exception { withAdditionalLogfile(null); assertThat(resolveLogFiles()) .contains( file("logs/crx/error.log"), file("logs/crx/error.log.0"), file("logs/crx/error.log.2020-11-23"), file("logs/error-withwhitespaces.log"), file("logs/error.log"), file("logs/error.log.1"), file("logs/error.log.2020-01-01")); }