diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperTest.java index d76e7d11235..dfde0006df9 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperTest.java @@ -56,7 +56,6 @@ public void getMutatedGenes() { var testBrca1AlterationCount = alterationCountByGenes.stream().filter(a -> Objects.equals(a.getHugoGeneSymbol(), "brca1")).findFirst(); assert(testBrca1AlterationCount.isPresent()); assertEquals(Integer.valueOf(5), testBrca1AlterationCount.get().getTotalCount()); - assertEquals(1, testBrca1AlterationCount.get().getMatchingGenePanelIds().size()); } @Test diff --git a/src/test/java/org/cbioportal/service/impl/AlterationCountServiceImplTest.java b/src/test/java/org/cbioportal/service/impl/AlterationCountServiceImplTest.java index bd2c4955826..c000835c32d 100644 --- a/src/test/java/org/cbioportal/service/impl/AlterationCountServiceImplTest.java +++ b/src/test/java/org/cbioportal/service/impl/AlterationCountServiceImplTest.java @@ -1,10 +1,18 @@ package org.cbioportal.service.impl; import org.apache.commons.math3.util.Pair; -import org.cbioportal.model.*; +import org.cbioportal.model.AlterationCountByGene; +import org.cbioportal.model.AlterationCountByStructuralVariant; +import org.cbioportal.model.AlterationFilter; +import org.cbioportal.model.CNA; +import org.cbioportal.model.CopyNumberCountByGene; +import org.cbioportal.model.MolecularProfile; +import org.cbioportal.model.MolecularProfileCaseIdentifier; +import org.cbioportal.model.MutationEventType; import org.cbioportal.model.util.Select; import org.cbioportal.persistence.AlterationRepository; import org.cbioportal.persistence.MolecularProfileRepository; +import org.cbioportal.persistence.StudyViewRepository; import org.cbioportal.service.exception.MolecularProfileNotFoundException; import org.cbioportal.service.util.AlterationEnrichmentUtil; import org.cbioportal.service.util.MolecularProfileUtil; @@ -14,17 +22,25 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.TreeSet; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.anyList; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class AlterationCountServiceImplTest extends BaseServiceImplTest { - @InjectMocks private AlterationCountServiceImpl alterationCountService; @Mock private AlterationRepository alterationRepository; @@ -39,6 +55,8 @@ public class AlterationCountServiceImplTest extends BaseServiceImplTest { private MolecularProfileUtil molecularProfileUtil; @Mock private MolecularProfileRepository molecularProfileRepository; + @Mock + private StudyViewRepository studyViewRepository; List caseIdentifiers = Arrays.asList(new MolecularProfileCaseIdentifier("A", MOLECULAR_PROFILE_ID)); Select mutationEventTypes = Select.byValues(Arrays.asList(MutationEventType.missense_mutation)); @@ -64,6 +82,11 @@ public class AlterationCountServiceImplTest extends BaseServiceImplTest { @Before public void setup() { + MockitoAnnotations.openMocks(this); + + alterationCountService = new AlterationCountServiceImpl(alterationRepository, alterationEnrichmentUtil, + alterationEnrichmentUtilCna, alterationEnrichmentUtilStructVar, molecularProfileRepository, studyViewRepository); + MolecularProfile molecularProfile = new MolecularProfile(); molecularProfile.setStableId(MOLECULAR_PROFILE_ID); molecularProfile.setCancerStudyIdentifier(STUDY_ID);