DefaultSearchDepthPolicy extends AbstractPolicy implements SearchDepthPolicy { public boolean nextLevelEnabled(Request request) { if(!isAssignedValueRequestsCanSpawnSubsearch() && request.containsAssignedValue()) { return false; } return levelEnabled(request.getLevel() + 1); }  boolean continueSearch(SearchResult searchResult); int getMaximumDepth(); @Override List<Search> inputForSubSearches(SearchResult searchResult); @Override String getDescription(); boolean levelEnabled(int level); boolean nextLevelEnabled(Request request); void setMaximumDepth(int maximumDepth); boolean isAssignedValueRequestsCanSpawnSubsearch(); void setAssignedValueRequestsCanSpawnSubsearch(boolean assignedValueRequestsCanSpawnSubsearch); @Override int hashCode(); @Override boolean equals(Object obj); static final boolean DEFAULT_ASSIGNED_VALUE_REQUESTS_CAN_SPAWN_SUBSEARCH; static final int DEFAULT_MAX_DEPTH; }
@Test public void testNextLevelEnabled() { assertTrue(this.policy.nextLevelEnabled(fix.requestLevelZero)); assertTrue(this.policy.nextLevelEnabled(fix.requestLevelOne)); assertFalse(this.policy.nextLevelEnabled(fix.requestLevelFour)); }
@Test public void testNextLevelEnabled_falseForAssignedValue() { assertFalse(fix.requestLevelOne.containsAssignedValue()); assertTrue(this.policy.nextLevelEnabled(fix.requestLevelOne)); fix.requestLevelOne.setBoroughInputValue(CountyResolver.BRONX); assertTrue(fix.requestLevelOne.containsAssignedValue()); assertFalse(this.policy.nextLevelEnabled(fix.requestLevelOne)); }