@Test public void buildWorksIfVocabularyTermsAreNotEmpty() { final VocabularyTerm presentTerm = mock(VocabularyTerm.class); final VocabularyTerm absentTerm = mock(VocabularyTerm.class); final Set<VocabularyTerm> presentTerms = new HashSet<>(); presentTerms.add(presentTerm); final Set<VocabularyTerm> absentTerms = new HashSet<>(); absentTerms.add(absentTerm); final List<String> associatedGenes = new ArrayList<>(); associatedGenes.add(GENE1); associatedGenes.add(GENE2); when(presentTerm.get(ASSOCIATED_GENES)).thenReturn(associatedGenes); when(presentTerm.getId()).thenReturn(HPO_TERM1); when(absentTerm.getId()).thenReturn(HPO_TERM2); when(presentTerm.getTranslatedName()).thenReturn(HPO_TERM1); when(absentTerm.getTranslatedName()).thenReturn(HPO_TERM2); when(presentTerm.getName()).thenReturn(HPO_TERM1); when(absentTerm.getName()).thenReturn(HPO_TERM2); when(this.hgnc.getTerm(anyString())).thenReturn(null); final GenePanel genePanel = this.genePanelFactory.build(presentTerms, absentTerms); Assert.assertEquals(2, genePanel.size()); Assert.assertEquals(presentTerms, genePanel.getPresentTerms()); Assert.assertEquals(absentTerms, genePanel.getAbsentTerms()); final List<TermsForGene> termsForGene = genePanel.getTermsForGeneList(); Assert.assertEquals(2, termsForGene.size()); Assert.assertEquals(GENE1, termsForGene.get(0).getGeneId()); Assert.assertEquals(GENE1, termsForGene.get(0).getGeneSymbol()); Assert.assertEquals(1, termsForGene.get(0).getCount()); Assert.assertEquals(presentTerms, termsForGene.get(0).getTerms()); Assert.assertEquals(GENE2, termsForGene.get(1).getGeneId()); Assert.assertEquals(GENE2, termsForGene.get(1).getGeneSymbol()); Assert.assertEquals(1, termsForGene.get(1).getCount()); Assert.assertEquals(presentTerms, termsForGene.get(1).getTerms()); Assert.assertNull(genePanel.getMatchCounts()); }
@Override public GenePanel build( @Nonnull final Collection<VocabularyTerm> presentTerms, @Nonnull final Collection<VocabularyTerm> absentTerms) { Validate.notNull(presentTerms); Validate.notNull(absentTerms); return new DefaultGenePanelImpl(presentTerms, absentTerms, this.generateMatchCount, this.vocabularyManager); }
DefaultGenePanelFactoryImpl implements GenePanelFactory { @Override public GenePanel build( @Nonnull final Collection<VocabularyTerm> presentTerms, @Nonnull final Collection<VocabularyTerm> absentTerms) { Validate.notNull(presentTerms); Validate.notNull(absentTerms); return new DefaultGenePanelImpl(presentTerms, absentTerms, this.generateMatchCount, this.vocabularyManager); } }
DefaultGenePanelFactoryImpl implements GenePanelFactory { @Override public GenePanel build( @Nonnull final Collection<VocabularyTerm> presentTerms, @Nonnull final Collection<VocabularyTerm> absentTerms) { Validate.notNull(presentTerms); Validate.notNull(absentTerms); return new DefaultGenePanelImpl(presentTerms, absentTerms, this.generateMatchCount, this.vocabularyManager); }  }
DefaultGenePanelFactoryImpl implements GenePanelFactory { @Override public GenePanel build( @Nonnull final Collection<VocabularyTerm> presentTerms, @Nonnull final Collection<VocabularyTerm> absentTerms) { Validate.notNull(presentTerms); Validate.notNull(absentTerms); return new DefaultGenePanelImpl(presentTerms, absentTerms, this.generateMatchCount, this.vocabularyManager); }  @Override GenePanelFactory withMatchCount(final boolean generate); @Override GenePanel build(
        @Nonnull final Collection<VocabularyTerm> presentTerms,
        @Nonnull final Collection<VocabularyTerm> absentTerms); @Override GenePanel build(
        @Nonnull final Collection<VocabularyTerm> presentTerms,
        @Nonnull final Collection<VocabularyTerm> absentTerms,
        @Nonnull final Collection<VocabularyTerm> rejectedGenes); @Override GenePanel build(@Nonnull final Patient patient); @Override GenePanel build(@Nonnull final Patient patient, final boolean excludeRejectedGenes); }
DefaultGenePanelFactoryImpl implements GenePanelFactory { @Override public GenePanel build( @Nonnull final Collection<VocabularyTerm> presentTerms, @Nonnull final Collection<VocabularyTerm> absentTerms) { Validate.notNull(presentTerms); Validate.notNull(absentTerms); return new DefaultGenePanelImpl(presentTerms, absentTerms, this.generateMatchCount, this.vocabularyManager); }  @Override GenePanelFactory withMatchCount(final boolean generate); @Override GenePanel build(
        @Nonnull final Collection<VocabularyTerm> presentTerms,
        @Nonnull final Collection<VocabularyTerm> absentTerms); @Override GenePanel build(
        @Nonnull final Collection<VocabularyTerm> presentTerms,
        @Nonnull final Collection<VocabularyTerm> absentTerms,
        @Nonnull final Collection<VocabularyTerm> rejectedGenes); @Override GenePanel build(@Nonnull final Patient patient); @Override GenePanel build(@Nonnull final Patient patient, final boolean excludeRejectedGenes);  }