SearchParameters { public SearchPolicy buildSearchPolicy() { SearchPolicy policy = new SearchPolicy(); configure((DefaultExactMatchPolicy) policy.getExactMatchPolicy()); configure((DefaultSearchDepthPolicy) policy.getSearchDepthPolicy()); configure((DefaultSimilarNamesPolicy) policy.getSimilarNamesPolicy()); return policy; } SearchParameters();  SearchParameters(String input); int getMaxDepth(); void setMaxDepth(int maxDepth); int getSimilarNamesDistance(); void setSimilarNamesDistance(int similarNamesDistance); int getExactMatchMaxLevel(); void setExactMatchMaxLevel(int exactMatchMaxLevel); boolean isExactMatchForSingleSuccess(); void setExactMatchForSingleSuccess(boolean exactMatchForSingleSuccess); String getInput(); void setInput(String input); boolean isReturnTokens(); void setReturnTokens(boolean returnTokens); boolean isReturnPolicy(); void setReturnPolicy(boolean returnPolicy); SearchPolicy buildSearchPolicy(); @Override int hashCode(); @Override boolean equals(Object obj); boolean isReturnRejections(); void setReturnRejections(boolean returnRejections); boolean isReturnPossiblesWithExactMatch(); void setReturnPossiblesWithExactMatch(boolean returnPossiblesWithExactMatch); static final int MAX_CONFIGURABLE_DEPTH; }
@Test public void testBuildSearchPolicy() { params.setMaxDepth(5); params.setSimilarNamesDistance(2); params.setExactMatchMaxLevel(3); params.setExactMatchForSingleSuccess(true); SearchPolicy searchPolicy = params.buildSearchPolicy(); assertThat(searchPolicy).isNotNull(); assertThat(((DefaultSearchDepthPolicy) searchPolicy.getSearchDepthPolicy()).getMaximumDepth()).isEqualTo(5); assertThat(((DefaultSimilarNamesPolicy) searchPolicy.getSimilarNamesPolicy()).getSimilarNamesDistance()) .isEqualTo(2); assertThat(((DefaultExactMatchPolicy) searchPolicy.getExactMatchPolicy()).getExactMatchMaxLevel()).isEqualTo(3); assertThat(((DefaultExactMatchPolicy) searchPolicy.getExactMatchPolicy()).isExactMatchForSingleSuccess()) .isEqualTo(true); }