@Test public void searchReturnsCorrectSortedListOfTermsIfOneVocabHasTermsWithNullForScore() { when(this.result1.get(SCORE_LABEL)).thenReturn(null); when(this.result2.get(SCORE_LABEL)).thenReturn(null); when(this.result3.get(SCORE_LABEL)).thenReturn(null); when(this.result4.get(SCORE_LABEL)).thenReturn((float) 3.2353); when(this.result5.get(SCORE_LABEL)).thenReturn((float) 3.27893); when(this.result6.get(SCORE_LABEL)).thenReturn((float) 1.28793); when(this.hgnc.search(SEARCH_QUERY_A_LABEL, GENE_CATEGORY, 3, null, null)).thenReturn( Arrays.asList(this.result1, this.result2, this.result3)); when(this.omim.search(SEARCH_QUERY_A_LABEL, GENE_CATEGORY, 3, null, null)).thenReturn( Arrays.asList(this.result4, this.result5, this.result6)); final List<VocabularyTerm> terms = this.vocabularyManager.search(SEARCH_QUERY_A_LABEL, GENE_CATEGORY, 3); Assert.assertEquals(3, terms.size()); Assert.assertEquals(this.result5, terms.get(0)); Assert.assertEquals(this.result4, terms.get(1)); Assert.assertEquals(this.result6, terms.get(2)); }
@Override public List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category, final int maxResults) { if (StringUtils.isBlank(input) || StringUtils.isBlank(category)) { return Collections.emptyList(); } final Set<Vocabulary> categorizedVocabularies = this.constructVocabulariesByCategory().get(category); if (CollectionUtils.isEmpty(categorizedVocabularies)) { this.logger.warn("No vocabularies associated with the specified category: {}", category); return Collections.emptyList(); } return search(input, maxResults, category, categorizedVocabularies); }
DefaultVocabularyManager implements VocabularyManager { @Override public List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category, final int maxResults) { if (StringUtils.isBlank(input) || StringUtils.isBlank(category)) { return Collections.emptyList(); } final Set<Vocabulary> categorizedVocabularies = this.constructVocabulariesByCategory().get(category); if (CollectionUtils.isEmpty(categorizedVocabularies)) { this.logger.warn("No vocabularies associated with the specified category: {}", category); return Collections.emptyList(); } return search(input, maxResults, category, categorizedVocabularies); } }
DefaultVocabularyManager implements VocabularyManager { @Override public List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category, final int maxResults) { if (StringUtils.isBlank(input) || StringUtils.isBlank(category)) { return Collections.emptyList(); } final Set<Vocabulary> categorizedVocabularies = this.constructVocabulariesByCategory().get(category); if (CollectionUtils.isEmpty(categorizedVocabularies)) { this.logger.warn("No vocabularies associated with the specified category: {}", category); return Collections.emptyList(); } return search(input, maxResults, category, categorizedVocabularies); }  }
DefaultVocabularyManager implements VocabularyManager { @Override public List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category, final int maxResults) { if (StringUtils.isBlank(input) || StringUtils.isBlank(category)) { return Collections.emptyList(); } final Set<Vocabulary> categorizedVocabularies = this.constructVocabulariesByCategory().get(category); if (CollectionUtils.isEmpty(categorizedVocabularies)) { this.logger.warn("No vocabularies associated with the specified category: {}", category); return Collections.emptyList(); } return search(input, maxResults, category, categorizedVocabularies); }  @Override VocabularyTerm resolveTerm(String termId); @Override Vocabulary getVocabulary(String vocabularyId); @Override Set<Vocabulary> getVocabularies(final String category); @Override List<String> getAvailableVocabularies(); @Override List<String> getAvailableCategories(); @Override List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category,
        final int maxResults); @Override boolean hasVocabulary(final String vocabulary); @Override boolean hasCategory(final String category); }
DefaultVocabularyManager implements VocabularyManager { @Override public List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category, final int maxResults) { if (StringUtils.isBlank(input) || StringUtils.isBlank(category)) { return Collections.emptyList(); } final Set<Vocabulary> categorizedVocabularies = this.constructVocabulariesByCategory().get(category); if (CollectionUtils.isEmpty(categorizedVocabularies)) { this.logger.warn("No vocabularies associated with the specified category: {}", category); return Collections.emptyList(); } return search(input, maxResults, category, categorizedVocabularies); }  @Override VocabularyTerm resolveTerm(String termId); @Override Vocabulary getVocabulary(String vocabularyId); @Override Set<Vocabulary> getVocabularies(final String category); @Override List<String> getAvailableVocabularies(); @Override List<String> getAvailableCategories(); @Override List<VocabularyTerm> search(@Nullable final String input, @Nullable final String category,
        final int maxResults); @Override boolean hasVocabulary(final String vocabulary); @Override boolean hasCategory(final String category);  }