@@ -0,0 +1,3251 @@
+package org.cbioportal.service.impl;%0A%0Aimport org.cbioportal.model.CNA;%0Aimport org.cbioportal.model.CopyNumberCountByGene;%0Aimport org.cbioportal.model.EnrichmentType;%0Aimport org.cbioportal.model.MolecularProfileCaseIdentifier;%0Aimport org.cbioportal.model.util.Select;%0Aimport org.cbioportal.service.AlterationCountService;%0Aimport org.cbioportal.service.exception.MolecularProfileNotFoundException;%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.ArgumentMatcher;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.junit.MockitoJUnitRunner;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport static org.mockito.ArgumentMatchers.argThat;%0Aimport static org.mockito.ArgumentMatchers.eq;%0Aimport static org.mockito.Mockito.when;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class CopyNumberEnrichmentServiceImplTest %7B%0A%0A    @InjectMocks%0A    private CopyNumberEnrichmentServiceImpl cnaCountService;%0A    @Mock%0A    private AlterationCountService alterationCountService;%0A    %0A    // FIXME use SelectMockitoArgumentMatcher in util module when implemented%0A    // see issue https://github.com/cBioPortal/cbioportal/issues/8297%0A    private static class SelectMockitoArgumentMatcher implements ArgumentMatcher%3CSelect%3E %7B%0A        private String checkWhat;%0A%0A        public SelectMockitoArgumentMatcher(String checkWhat) %7B%0A            this.checkWhat = checkWhat;%0A        %7D%0A%0A        @Override%0A        public boolean matches(Select select) %7B%0A            switch (checkWhat) %7B%0A                case %22ALL%22:%0A                    return select.hasAll();%0A                case %22EMPTY%22:%0A                    return select.hasNone();%0A                case %22SOME%22:%0A                    return select.hasValues();%0A                default:%0A                    return false;%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A%0A        List%3CMolecularProfileCaseIdentifier%3E molecularProfileCaseSet = new ArrayList%3C%3E();%0A        molecularProfileCaseSet.add(new MolecularProfileCaseIdentifier(%22caseA%22, %22profileB%22));%0A        %0A        groupMolecularProfileCaseSets = new HashMap%3C%3E();%0A        groupMolecularProfileCaseSets.put(%22altered group%22, molecularProfileCaseSet);%0A        groupMolecularProfileCaseSets.put(%22unaltered group%22, molecularProfileCaseSet);%0A%0A        List%3CCopyNumberCountByGene%3E counts = new ArrayList%3C%3E();%0A        %0A        when(alterationCountService.getSampleCnaCounts(%0A            eq(molecularProfileCaseSet),%0A            argThat(new SelectMockitoArgumentMatcher(%22ALL%22)),%0A            eq(true),%0A            eq(true),%0A            argThat(new SelectMockitoArgumentMatcher(%22SOME%22)))%0A        ).thenReturn(counts);%0A    %7D%0A%0A    Map%3CString, List%3CMolecularProfileCaseIdentifier%3E%3E groupMolecularProfileCaseSets;%0A%0A    @Test%0A    public void testGetCopyNumberCountByGeneAndGroup() throws MolecularProfileNotFoundException %7B%0A        Map%3CString, List%3CCopyNumberCountByGene%3E%3E copyNumberCountByGeneAndGroup = cnaCountService.getCopyNumberCountByGeneAndGroup(groupMolecularProfileCaseSets, CNA.AMP, EnrichmentType.SAMPLE);%0A        Assert.assertEquals(2, copyNumberCountByGeneAndGroup.keySet().size());%0A    %7D%0A%7D%0A

Add unit test for getCopyNumberCountByGeneAndGroup()