gt:         List<Sample> filteredSamples = new ArrayList<>();
context: package org.cbioportal.web;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.List;
  
  import org.cbioportal.model.ClinicalAttribute;
  import org.cbioportal.model.ClinicalData;
  import org.cbioportal.model.ClinicalDataCount;
  import org.cbioportal.model.ClinicalDataCountItem;
  import org.cbioportal.model.CopyNumberCountByGene;
  import org.cbioportal.model.GenePanelData;
  import org.cbioportal.model.MolecularProfile;
  import org.cbioportal.model.MutationCountByGene;
  import org.cbioportal.model.Sample;
  import org.cbioportal.service.ClinicalAttributeService;
  import org.cbioportal.service.ClinicalDataService;
  import org.cbioportal.service.DiscreteCopyNumberService;
  import org.cbioportal.service.GenePanelService;
  import org.cbioportal.service.MolecularProfileService;
  import org.cbioportal.service.MutationService;
  import org.cbioportal.service.PatientService;
  import org.cbioportal.service.SampleService;
  import org.cbioportal.service.TreatmentService;
  import org.cbioportal.web.parameter.ClinicalDataBinCountFilter;
  import org.cbioportal.web.parameter.ClinicalDataBinFilter;
  import org.cbioportal.web.parameter.ClinicalDataCountFilter;
  import org.cbioportal.web.parameter.ClinicalDataFilter;
  import org.cbioportal.web.parameter.SampleIdentifier;
  import org.cbioportal.web.parameter.StudyViewFilter;
  import org.cbioportal.web.util.StudyViewFilterApplier;
  import org.junit.Before;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.mockito.Mockito;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.http.MediaType;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  import org.springframework.test.context.web.WebAppConfiguration;
  import org.springframework.test.web.servlet.MockMvc;
  import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
  import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
  import org.springframework.test.web.servlet.setup.MockMvcBuilders;
  import org.springframework.web.context.WebApplicationContext;
  
  import com.fasterxml.jackson.databind.ObjectMapper;
  
  @RunWith(SpringJUnit4ClassRunner.class)
  @WebAppConfiguration
  @ContextConfiguration("/applicationContext-web-test.xml")
  @Configuration
  public class StudyViewControllerTest {
  
      private static final String TEST_STUDY_ID = "test_study_id";
      private static final String TEST_SAMPLE_ID_1 = "test_sample_id_1";
      private static final String TEST_SAMPLE_ID_2 = "test_sample_id_2";
      private static final String TEST_SAMPLE_ID_3 = "test_sample_id_3";
      private static final String TEST_PATIENT_ID_1 = "test_patient_id_1";
      private static final String TEST_PATIENT_ID_2 = "test_patient_id_2";
      private static final String TEST_ATTRIBUTE_ID = "test_attribute_id";
      private static final String TEST_MOLEULAR_PROFILE_ID_1 = "test_study_id_profile_type_1";
      private static final String TEST_MOLEULAR_PROFILE_ID_2 = "test_study_id_profile_type_2";
      private static final String TEST_CLINICAL_DATA_VALUE_1 = "value1";
      private static final String TEST_CLINICAL_DATA_VALUE_2 = "value2";
      private static final String TEST_CLINICAL_DATA_VALUE_3 = "3";
      private static final Integer TEST_ENTREZ_GENE_ID_1 = 1;
      private static final Integer TEST_ENTREZ_GENE_ID_2 = 2;
      private static final String TEST_HUGO_GENE_SYMBOL_1 = "test_hugo_gene_symbol_1";
      private static final String TEST_HUGO_GENE_SYMBOL_2 = "test_hugo_gene_symbol_2";
      private static final String TEST_CYTOBAND_1 = "test_cytoband_1";
      private static final String TEST_CYTOBAND_2 = "test_cytoband_2";
  
      @Autowired
      private WebApplicationContext wac;
  
      @Autowired
      private StudyViewFilterApplier studyViewFilterApplier;
      @Autowired
      private ClinicalDataService clinicalDataService;
      @Autowired
      private MutationService mutationService;
      @Autowired
      private MolecularProfileService molecularProfileService;
      @Autowired
      private DiscreteCopyNumberService discreteCopyNumberService;
      @Autowired
      private SampleService sampleService;
      @Autowired
      private GenePanelService genePanelService;
      @Autowired
      private ClinicalAttributeService clinicalAttributeService;
      @Autowired
      private PatientService patientService;
  
      private ObjectMapper objectMapper = new ObjectMapper();
  
      private MockMvc mockMvc;
  
      @Bean
      public StudyViewFilterApplier studyViewFilterApplier() {
          return Mockito.mock(StudyViewFilterApplier.class);
      }
      
      @Bean
      public TreatmentService treatmentService() {
          return Mockito.mock(TreatmentService.class);
      }
  
      @Before
      public void setUp() throws Exception {
  
          Mockito.reset(studyViewFilterApplier);
          Mockito.reset(clinicalDataService);
          Mockito.reset(mutationService);
          Mockito.reset(molecularProfileService);
          Mockito.reset(discreteCopyNumberService);
          Mockito.reset(sampleService);
          Mockito.reset(genePanelService);
          Mockito.reset(clinicalAttributeService);
          Mockito.reset(patientService);
          mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
      }
  
      @Test
      public void fetchClinicalDataCounts() throws Exception {
  
          List<SampleIdentifier> filteredSampleIdentifiers = new ArrayList<>();
          SampleIdentifier sampleIdentifier = new SampleIdentifier();
          sampleIdentifier.setSampleId(TEST_SAMPLE_ID_1);
          sampleIdentifier.setStudyId(TEST_STUDY_ID);
          filteredSampleIdentifiers.add(sampleIdentifier);
          Mockito.when(studyViewFilterApplier.apply(Mockito.any())).thenReturn(filteredSampleIdentifiers);
  
          List<ClinicalDataCountItem> clinicalDataCountItems = new ArrayList<>();
          ClinicalDataCountItem clinicalDataCountItem = new ClinicalDataCountItem();
          clinicalDataCountItem.setAttributeId(TEST_ATTRIBUTE_ID);
          List<ClinicalDataCount> clinicalDataCounts = new ArrayList<>();
          ClinicalDataCount clinicalDataCount1 = new ClinicalDataCount();
          clinicalDataCount1.setAttributeId(TEST_ATTRIBUTE_ID);
          clinicalDataCount1.setValue(TEST_CLINICAL_DATA_VALUE_1);
          clinicalDataCount1.setCount(3);
          clinicalDataCounts.add(clinicalDataCount1);
          ClinicalDataCount clinicalDataCount2 = new ClinicalDataCount();
          clinicalDataCount2.setAttributeId(TEST_ATTRIBUTE_ID);
          clinicalDataCount2.setValue(TEST_CLINICAL_DATA_VALUE_2);
          clinicalDataCount2.setCount(1);
          clinicalDataCounts.add(clinicalDataCount2);
          clinicalDataCountItem.setCounts(clinicalDataCounts);
          clinicalDataCountItems.add(clinicalDataCountItem);
          
          Mockito.when(clinicalDataService.fetchClinicalDataCounts(Mockito.anyList(), Mockito.anyList(), 
              Mockito.anyList())).thenReturn(clinicalDataCountItems);
  
          ClinicalDataCountFilter clinicalDataCountFilter = new ClinicalDataCountFilter();
          ClinicalDataFilter clinicalDataFilter = new ClinicalDataFilter();
          clinicalDataFilter.setAttributeId(TEST_ATTRIBUTE_ID);
          clinicalDataCountFilter.setAttributes(Arrays.asList(clinicalDataFilter));
          StudyViewFilter studyViewFilter = new StudyViewFilter();
          studyViewFilter.setStudyIds(Arrays.asList(TEST_STUDY_ID));
          clinicalDataCountFilter.setStudyViewFilter(studyViewFilter);
  
          mockMvc.perform(MockMvcRequestBuilders.post("/clinical-data-counts/fetch")
              .accept(MediaType.APPLICATION_JSON)
              .contentType(MediaType.APPLICATION_JSON)
              .content(objectMapper.writeValueAsString(clinicalDataCountFilter)))
              .andExpect(MockMvcResultMatchers.status().isOk())
              .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].attributeId").value(TEST_ATTRIBUTE_ID))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].counts[0].attributeId").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].counts[0].value").value(TEST_CLINICAL_DATA_VALUE_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].counts[0].count").value(3))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].counts[1].attributeId").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].counts[1].value").value(TEST_CLINICAL_DATA_VALUE_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].counts[1].count").value(1));
      }
  
      @Test
      public void fetchClinicalDataBinCounts() throws Exception
      {
          List<SampleIdentifier> filteredSampleIdentifiers = new ArrayList<>();
          SampleIdentifier sampleIdentifier = new SampleIdentifier();
          sampleIdentifier.setSampleId(TEST_SAMPLE_ID_1);
          sampleIdentifier.setStudyId(TEST_STUDY_ID);
          filteredSampleIdentifiers.add(sampleIdentifier);
          Mockito.when(studyViewFilterApplier.apply(Mockito.any())).thenReturn(filteredSampleIdentifiers);
  
          List<ClinicalData> clinicalData = new ArrayList<>();
          ClinicalData clinicalData1 = new ClinicalData();
          clinicalData1.setAttrId(TEST_ATTRIBUTE_ID);
          clinicalData1.setAttrValue(TEST_CLINICAL_DATA_VALUE_1);
          clinicalData1.setStudyId(TEST_STUDY_ID);
          clinicalData1.setSampleId(TEST_SAMPLE_ID_1);
          clinicalData1.setPatientId(TEST_PATIENT_ID_1);
          clinicalData.add(clinicalData1);
          ClinicalData clinicalData2 = new ClinicalData();
          clinicalData2.setAttrId(TEST_ATTRIBUTE_ID);
          clinicalData2.setAttrValue(TEST_CLINICAL_DATA_VALUE_2);
          clinicalData2.setStudyId(TEST_STUDY_ID);
          clinicalData2.setSampleId(TEST_SAMPLE_ID_2);
          clinicalData2.setPatientId(TEST_PATIENT_ID_2);
          clinicalData.add(clinicalData2);
          ClinicalData clinicalData3 = new ClinicalData();
          clinicalData3.setAttrId(TEST_ATTRIBUTE_ID);
          clinicalData3.setAttrValue(TEST_CLINICAL_DATA_VALUE_3);
          clinicalData3.setStudyId(TEST_STUDY_ID);
          clinicalData3.setSampleId(TEST_SAMPLE_ID_3);
          clinicalData.add(clinicalData3);
  
          Mockito.when(clinicalDataService.fetchClinicalData(Mockito.anyList(), Mockito.anyList(),
              Mockito.anyList(), Mockito.any(String.class), Mockito.any(String.class))).thenReturn(clinicalData);
  
          ClinicalAttribute clinicalAttribute1 =new ClinicalAttribute();
          clinicalAttribute1.setAttrId(TEST_ATTRIBUTE_ID);
          clinicalAttribute1.setPatientAttribute(false);
          
          Mockito.when(clinicalAttributeService.getClinicalAttributesByStudyIdsAndAttributeIds(
                  Mockito.anyList(), Mockito.anyList()))
          .thenReturn(Arrays.asList(clinicalAttribute1));
  
          Mockito.when(patientService.getPatientsOfSamples(Mockito.anyList(), Mockito.anyList())).thenReturn(Arrays.asList());
  
          ClinicalDataBinCountFilter clinicalDataBinCountFilter = new ClinicalDataBinCountFilter();
          ClinicalDataBinFilter clinicalDataBinFilter = new ClinicalDataBinFilter();
          clinicalDataBinFilter.setAttributeId(TEST_ATTRIBUTE_ID);
          clinicalDataBinFilter.setDisableLogScale(false);
          clinicalDataBinCountFilter.setAttributes(Collections.singletonList(clinicalDataBinFilter));
          StudyViewFilter studyViewFilter = new StudyViewFilter();
          studyViewFilter.setStudyIds(Collections.singletonList(TEST_STUDY_ID));
          clinicalDataBinCountFilter.setStudyViewFilter(studyViewFilter);
  
          mockMvc.perform(MockMvcRequestBuilders.post("/clinical-data-bin-counts/fetch")
              .accept(MediaType.APPLICATION_JSON)
              .contentType(MediaType.APPLICATION_JSON)
              .content(objectMapper.writeValueAsString(clinicalDataBinCountFilter)))
              .andExpect(MockMvcResultMatchers.status().isOk())
              .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].attributeId").value(TEST_ATTRIBUTE_ID))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].specialValue").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].start").value(3))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].end").value(3))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].count").value(1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].attributeId").value(TEST_ATTRIBUTE_ID))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].specialValue").value(TEST_CLINICAL_DATA_VALUE_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].start").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].end").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].count").value(1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[2].attributeId").value(TEST_ATTRIBUTE_ID))
              .andExpect(MockMvcResultMatchers.jsonPath("$[2].specialValue").value(TEST_CLINICAL_DATA_VALUE_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[2].start").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[2].end").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[2].count").value(1));
      }
  
      @Test
      public void fetchMutatedGenes() throws Exception {
  
          MolecularProfile molecularProfile = new MolecularProfile();
          molecularProfile.setCancerStudyIdentifier(TEST_STUDY_ID);
          Mockito.when(molecularProfileService.getMolecularProfile(Mockito.any())).thenReturn(molecularProfile);
  
          List<SampleIdentifier> filteredSampleIdentifiers = new ArrayList<>();
          SampleIdentifier sampleIdentifier = new SampleIdentifier();
          sampleIdentifier.setSampleId(TEST_SAMPLE_ID_1);
          sampleIdentifier.setStudyId(TEST_STUDY_ID);
          filteredSampleIdentifiers.add(sampleIdentifier);
          Mockito.when(studyViewFilterApplier.apply(Mockito.any())).thenReturn(filteredSampleIdentifiers);
  
          List<MutationCountByGene> mutationCounts = new ArrayList<>();
          MutationCountByGene mutationCount1 = new MutationCountByGene();
          mutationCount1.setEntrezGeneId(TEST_ENTREZ_GENE_ID_1);
          mutationCount1.setHugoGeneSymbol(TEST_HUGO_GENE_SYMBOL_1);
          mutationCount1.setNumberOfAlteredCases(1);
          mutationCount1.setTotalCount(3);
          mutationCounts.add(mutationCount1);
          MutationCountByGene mutationCount2 = new MutationCountByGene();
          mutationCount2.setEntrezGeneId(TEST_ENTREZ_GENE_ID_2);
          mutationCount2.setHugoGeneSymbol(TEST_HUGO_GENE_SYMBOL_2);
          mutationCount2.setNumberOfAlteredCases(2);
          mutationCount2.setTotalCount(2);
          mutationCounts.add(mutationCount2);
  
          Mockito.when(mutationService.getSampleCountInMultipleMolecularProfiles(Mockito.anyList(),
              Mockito.anyList(), Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(mutationCounts);
  
          StudyViewFilter studyViewFilter = new StudyViewFilter();
          studyViewFilter.setStudyIds(Arrays.asList(TEST_STUDY_ID));
  
          mockMvc.perform(MockMvcRequestBuilders.post("/mutated-genes/fetch")
              .accept(MediaType.APPLICATION_JSON)
              .contentType(MediaType.APPLICATION_JSON)
              .content(objectMapper.writeValueAsString(studyViewFilter)))
              .andExpect(MockMvcResultMatchers.status().isOk())
              .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].entrezGeneId").value(TEST_ENTREZ_GENE_ID_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].hugoGeneSymbol").value(TEST_HUGO_GENE_SYMBOL_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].numberOfAlteredCases").value(2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].totalCount").value(2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].entrezGeneId").value(TEST_ENTREZ_GENE_ID_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].hugoGeneSymbol").value(TEST_HUGO_GENE_SYMBOL_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].numberOfAlteredCases").value(1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].totalCount").value(3));
      }
  
      @Test
      public void fetchFusionGenes() throws Exception {
  
          MolecularProfile molecularProfile = new MolecularProfile();
          molecularProfile.setCancerStudyIdentifier(TEST_STUDY_ID);
          Mockito.when(molecularProfileService.getMolecularProfile(Mockito.any())).thenReturn(molecularProfile);
  
          List<SampleIdentifier> filteredSampleIdentifiers = new ArrayList<>();
          SampleIdentifier sampleIdentifier = new SampleIdentifier();
          sampleIdentifier.setSampleId(TEST_SAMPLE_ID_1);
          sampleIdentifier.setStudyId(TEST_STUDY_ID);
          filteredSampleIdentifiers.add(sampleIdentifier);
          Mockito.when(studyViewFilterApplier.apply(Mockito.any())).thenReturn(filteredSampleIdentifiers);
  
          List<MutationCountByGene> fusionCounts = new ArrayList<>();
          MutationCountByGene fusionCount1 = new MutationCountByGene();
          fusionCount1.setEntrezGeneId(TEST_ENTREZ_GENE_ID_1);
          fusionCount1.setHugoGeneSymbol(TEST_HUGO_GENE_SYMBOL_1);
          fusionCount1.setNumberOfAlteredCases(1);
          fusionCount1.setTotalCount(1);
          fusionCounts.add(fusionCount1);
          MutationCountByGene fusionCount2 = new MutationCountByGene();
          fusionCount2.setEntrezGeneId(TEST_ENTREZ_GENE_ID_2);
          fusionCount2.setHugoGeneSymbol(TEST_HUGO_GENE_SYMBOL_2);
          fusionCount2.setNumberOfAlteredCases(2);
          fusionCount2.setTotalCount(2);
          fusionCounts.add(fusionCount2);
  
          Mockito.when(mutationService.getSampleCountInMultipleMolecularProfilesForFusions(Mockito.anyList(),
              Mockito.anyList(), Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean())).thenReturn(fusionCounts);
  
          StudyViewFilter studyViewFilter = new StudyViewFilter();
          studyViewFilter.setStudyIds(Arrays.asList(TEST_STUDY_ID));
  
          mockMvc.perform(MockMvcRequestBuilders.post("/fusion-genes/fetch")
              .accept(MediaType.APPLICATION_JSON)
              .contentType(MediaType.APPLICATION_JSON)
              .content(objectMapper.writeValueAsString(studyViewFilter)))
              .andExpect(MockMvcResultMatchers.status().isOk())
              .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].entrezGeneId").value(TEST_ENTREZ_GENE_ID_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].hugoGeneSymbol").value(TEST_HUGO_GENE_SYMBOL_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].numberOfAlteredCases").value(2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].totalCount").value(2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].entrezGeneId").value(TEST_ENTREZ_GENE_ID_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].hugoGeneSymbol").value(TEST_HUGO_GENE_SYMBOL_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].numberOfAlteredCases").value(1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].totalCount").value(1));
      }
  
      @Test
      public void fetchCNAGenes() throws Exception {
  
          MolecularProfile molecularProfile = new MolecularProfile();
          molecularProfile.setCancerStudyIdentifier(TEST_STUDY_ID);
          Mockito.when(molecularProfileService.getMolecularProfile(Mockito.any())).thenReturn(molecularProfile);
  
          List<SampleIdentifier> filteredSampleIdentifiers = new ArrayList<>();
          SampleIdentifier sampleIdentifier = new SampleIdentifier();
          sampleIdentifier.setSampleId(TEST_SAMPLE_ID_1);
          sampleIdentifier.setStudyId(TEST_STUDY_ID);
          filteredSampleIdentifiers.add(sampleIdentifier);
          Mockito.when(studyViewFilterApplier.apply(Mockito.any())).thenReturn(filteredSampleIdentifiers);
  
          List<CopyNumberCountByGene> cnaCounts = new ArrayList<>();
          CopyNumberCountByGene cnaCount1 = new CopyNumberCountByGene();
          cnaCount1.setEntrezGeneId(TEST_ENTREZ_GENE_ID_1);
          cnaCount1.setHugoGeneSymbol(TEST_HUGO_GENE_SYMBOL_1);
          cnaCount1.setNumberOfAlteredCases(1);
          cnaCount1.setCytoband(TEST_CYTOBAND_1);
          cnaCount1.setAlteration(-2);
          cnaCounts.add(cnaCount1);
          CopyNumberCountByGene cnaCount2 = new CopyNumberCountByGene();
          cnaCount2.setEntrezGeneId(TEST_ENTREZ_GENE_ID_2);
          cnaCount2.setHugoGeneSymbol(TEST_HUGO_GENE_SYMBOL_2);
          cnaCount2.setNumberOfAlteredCases(2);
          cnaCount2.setCytoband(TEST_CYTOBAND_2);
          cnaCount2.setAlteration(2);
          cnaCounts.add(cnaCount2);
  
          Mockito.when(discreteCopyNumberService.getSampleCountInMultipleMolecularProfiles(Mockito.anyList(),
              Mockito.anyList(), Mockito.any(), Mockito.anyList(), Mockito.anyBoolean(), Mockito.anyBoolean()))
              .thenReturn(cnaCounts);
  
          StudyViewFilter studyViewFilter = new StudyViewFilter();
          studyViewFilter.setStudyIds(Arrays.asList(TEST_STUDY_ID));
  
          mockMvc.perform(MockMvcRequestBuilders.post("/cna-genes/fetch")
              .accept(MediaType.APPLICATION_JSON)
              .contentType(MediaType.APPLICATION_JSON)
              .content(objectMapper.writeValueAsString(studyViewFilter)))
              .andExpect(MockMvcResultMatchers.status().isOk())
              .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].entrezGeneId").value(TEST_ENTREZ_GENE_ID_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].hugoGeneSymbol").value(TEST_HUGO_GENE_SYMBOL_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].numberOfAlteredCases").value(2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].cytoband").value(TEST_CYTOBAND_2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].alteration").value(2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[0].totalCount").doesNotExist())
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].entrezGeneId").value(TEST_ENTREZ_GENE_ID_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].hugoGeneSymbol").value(TEST_HUGO_GENE_SYMBOL_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].numberOfAlteredCases").value(1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].cytoband").value(TEST_CYTOBAND_1))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].alteration").value(-2))
              .andExpect(MockMvcResultMatchers.jsonPath("$[1].totalCount").doesNotExist());
      }
  
      @Test
      public void fetchSampleIds() throws Exception {
  
          List<SampleIdentifier> filteredSampleIdentifiers = new ArrayList<>();
          SampleIdentifier sampleIdentifier = new SampleIdentifier();
          sampleIdentifier.setSampleId(TEST_SAMPLE_ID_1);
          sampleIdentifier.setStudyId(TEST_STUDY_ID);
          filteredSampleIdentifiers.add(sampleIdentifier);
  
          Mockito.when(studyViewFilterApplier.apply(Mockito.any())).thenReturn(filteredSampleIdentifiers);
          Mockito.when(studyViewFilterApplier.apply(Mockito.any(), Mockito.eq(false))).thenReturn(filteredSampleIdentifiers);
  
  