@Test public void testNoMatch() { SearchResult<TestSequencedWord> result = target.buildResult(WORDS, WORD_AA, "no-match"); validateNoMatch(result); }
public SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText) { if (StringUtils.isBlank(searchText)) { return new SearchResult<>(); } else { Predicate<SequencedWord> matcher = matchMaker.apply(searchText); List<T> matches = wordList.stream() .filter(matcher) .collect(toList()); if (matches.isEmpty()) { return searchResult(true, null, null, null, SEARCH_MATCH_NONE); } else { return updateForMatch(matches, currentWord); } } }
Searcher { public SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText) { if (StringUtils.isBlank(searchText)) { return new SearchResult<>(); } else { Predicate<SequencedWord> matcher = matchMaker.apply(searchText); List<T> matches = wordList.stream() .filter(matcher) .collect(toList()); if (matches.isEmpty()) { return searchResult(true, null, null, null, SEARCH_MATCH_NONE); } else { return updateForMatch(matches, currentWord); } } } }
Searcher { public SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText) { if (StringUtils.isBlank(searchText)) { return new SearchResult<>(); } else { Predicate<SequencedWord> matcher = matchMaker.apply(searchText); List<T> matches = wordList.stream() .filter(matcher) .collect(toList()); if (matches.isEmpty()) { return searchResult(true, null, null, null, SEARCH_MATCH_NONE); } else { return updateForMatch(matches, currentWord); } } } Searcher(final I18nManager i18nManager, final Function<String, Predicate<SequencedWord>> matchMaker); }
Searcher { public SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText) { if (StringUtils.isBlank(searchText)) { return new SearchResult<>(); } else { Predicate<SequencedWord> matcher = matchMaker.apply(searchText); List<T> matches = wordList.stream() .filter(matcher) .collect(toList()); if (matches.isEmpty()) { return searchResult(true, null, null, null, SEARCH_MATCH_NONE); } else { return updateForMatch(matches, currentWord); } } } Searcher(final I18nManager i18nManager, final Function<String, Predicate<SequencedWord>> matchMaker); SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText); }
Searcher { public SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText) { if (StringUtils.isBlank(searchText)) { return new SearchResult<>(); } else { Predicate<SequencedWord> matcher = matchMaker.apply(searchText); List<T> matches = wordList.stream() .filter(matcher) .collect(toList()); if (matches.isEmpty()) { return searchResult(true, null, null, null, SEARCH_MATCH_NONE); } else { return updateForMatch(matches, currentWord); } } } Searcher(final I18nManager i18nManager, final Function<String, Predicate<SequencedWord>> matchMaker); SearchResult<T> buildResult(final List<T> wordList, final T currentWord, final String searchText);  }