### Question:
DetectorFinder { public Optional<DetectorEvaluationTree> findDetectors(final File initialDirectory, final DetectorRuleSet detectorRuleSet, final DetectorFinderOptions options) throws DetectorFinderDirectoryListException { return findDetectors(initialDirectory, detectorRuleSet, 0, options); }  Optional<DetectorEvaluationTree> findDetectors(final File initialDirectory, final DetectorRuleSet detectorRuleSet, final DetectorFinderOptions options);  }### Answer:
@Test @DisabledOnOs(WINDOWS) public void testSimple() throws DetectorFinderDirectoryListException { Assumptions.assumeFalse(SystemUtils.IS_OS_WINDOWS); final File initialDirectory = initialDirectoryPath.toFile(); final File subDir = new File(initialDirectory, "testSimple"); subDir.mkdirs(); final File subSubDir1 = new File(subDir, "subSubDir1"); subSubDir1.mkdir(); final File subSubDir2 = new File(subDir, "subSubDir2"); subSubDir2.mkdir(); final DetectorRuleSet detectorRuleSet = new DetectorRuleSet(new ArrayList<>(0), new HashMap<>(0), new HashMap<>()); final Predicate<File> fileFilter = f -> true; final int maximumDepth = 10; final DetectorFinderOptions options = new DetectorFinderOptions(fileFilter, maximumDepth); final DetectorFinder finder = new DetectorFinder(); final Optional<DetectorEvaluationTree> tree = finder.findDetectors(initialDirectory, detectorRuleSet, options); final Set<DetectorEvaluationTree> testDirs = tree.get().getChildren(); DetectorEvaluationTree simpleTestDir = null; for (final DetectorEvaluationTree testDir : testDirs) { if (testDir.getDirectory().getName().equals("testSimple")) { simpleTestDir = testDir; break; } } final Set<DetectorEvaluationTree> subDirResults = simpleTestDir.getChildren(); assertEquals(2, subDirResults.size()); final String subDirContentsName = subDirResults.iterator().next().getDirectory().getName(); assertTrue(subDirContentsName.startsWith("subSubDir")); }
@Test @DisabledOnOs(WINDOWS) public void testSymLinksNotFollowed() throws IOException, DetectorFinderDirectoryListException { Assumptions.assumeFalse(SystemUtils.IS_OS_WINDOWS); final File initialDirectory = initialDirectoryPath.toFile(); final File subDir = new File(initialDirectory, "testSymLinksNotFollowed"); subDir.mkdirs(); final File link = new File(subDir, "linkToInitial"); final Path linkPath = link.toPath(); Files.createSymbolicLink(linkPath, initialDirectoryPath); final File regularDir = new File(subDir, "regularDir"); regularDir.mkdir(); final DetectorRuleSet detectorRuleSet = new DetectorRuleSet(new ArrayList<>(0), new HashMap<>(0), new HashMap<>(0)); final Predicate<File> fileFilter = f -> { return true; }; final int maximumDepth = 10; final DetectorFinderOptions options = new DetectorFinderOptions(fileFilter, maximumDepth); final DetectorFinder finder = new DetectorFinder(); final Optional<DetectorEvaluationTree> tree = finder.findDetectors(initialDirectory, detectorRuleSet, options); final Set<DetectorEvaluationTree> testDirs = tree.get().getChildren(); DetectorEvaluationTree symLinkTestDir = null; for (final DetectorEvaluationTree testDir : testDirs) { if (testDir.getDirectory().getName().equals("testSymLinksNotFollowed")) { symLinkTestDir = testDir; break; } } final Set<DetectorEvaluationTree> subDirResults = symLinkTestDir.getChildren(); assertEquals(1, subDirResults.size()); final String subDirContentsName = subDirResults.iterator().next().getDirectory().getName(); assertEquals("regularDir", subDirContentsName); }