### Question:
DetectorRuleSetEvaluator { public DetectorResult evaluateSearchable(final DetectorRuleSet detectorRuleSet, final DetectorRule detectorRule, final SearchEnvironment environment) { if (!environment.getDetectorFilter().test(detectorRule)) { return new ExcludedDetectorResult(); } final int maxDepth = detectorRule.getMaxDepth(); if (environment.getDepth() > maxDepth) { return new MaxDepthExceededDetectorResult(environment.getDepth(), maxDepth); } final Set<DetectorRule> yieldTo = environment.getAppliedSoFar().stream() .filter(it -> detectorRuleSet.getYieldsTo(detectorRule).contains(it)) .collect(Collectors.toSet()); if (yieldTo.size() > 0) { return new YieldedDetectorResult(yieldTo.stream().map(DetectorRule::getName).collect(Collectors.toSet())); } final boolean nestable = detectorRule.isNestable(); final boolean selfNestable = detectorRule.isSelfNestable(); if (environment.isForceNestedSearch()) { return new ForcedNestedPassedDetectorResult(); } else if (nestable) { if (!selfNestable && environment.getAppliedToParent().stream().anyMatch(parentApplied -> parentApplied.equals(detectorRule))) { return new NotSelfNestableDetectorResult(); } } else if (environment.getAppliedToParent().stream().anyMatch(it -> !it.isNestInvisible())) { return new NotNestableDetectorResult(); } return new PassedDetectorResult(); }  DetectorResult evaluateSearchable(final DetectorRuleSet detectorRuleSet, final DetectorRule detectorRule, final SearchEnvironment environment);  }### Answer:
@Test public void test() { final DetectorRuleSet detectorRuleSet = Mockito.mock(DetectorRuleSet.class); final DetectorRule detectorRule = Mockito.mock(DetectorRule.class); final SearchEnvironment environment = Mockito.mock(SearchEnvironment.class); final Predicate<DetectorRule> rulePredicate = it -> true; Mockito.when(environment.getDetectorFilter()).thenReturn(rulePredicate); Mockito.when(detectorRule.getMaxDepth()).thenReturn(1); Mockito.when(environment.getDepth()).thenReturn(0); final Set<DetectorRule> appliedSoFar = new HashSet<>(); Mockito.when(environment.getAppliedSoFar()).thenReturn(appliedSoFar); Mockito.when(detectorRule.isNestable()).thenReturn(true); Mockito.when(environment.isForceNestedSearch()).thenReturn(false); final DetectorRuleSetEvaluator evaluator = new DetectorRuleSetEvaluator(); final DetectorResult result = evaluator.evaluateSearchable(detectorRuleSet, detectorRule, environment); assertTrue(result.getPassed()); }