From c7e94ed57d672bb89b7b38ac7fdbf45270c0b64b Mon Sep 17 00:00:00 2001 From: Matthijs Pon Date: Tue, 19 Nov 2024 14:11:47 +0100 Subject: [PATCH] remove tests --- .../SingleCellExpressionServiceImplTest.java | 43 ----------- .../utils/SingleCellExpressionTestUtils.java | 52 ------------- .../SingleCellExpressionControllerTest.java | 76 ------------------- 3 files changed, 171 deletions(-) delete mode 100644 src/test/java/org/cbioportal/service/impl/SingleCellExpressionServiceImplTest.java delete mode 100644 src/test/java/org/cbioportal/utils/SingleCellExpressionTestUtils.java delete mode 100644 src/test/java/org/cbioportal/web/SingleCellExpressionControllerTest.java diff --git a/src/test/java/org/cbioportal/service/impl/SingleCellExpressionServiceImplTest.java b/src/test/java/org/cbioportal/service/impl/SingleCellExpressionServiceImplTest.java deleted file mode 100644 index 58d41f1ead0..00000000000 --- a/src/test/java/org/cbioportal/service/impl/SingleCellExpressionServiceImplTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.cbioportal.service.impl; - -import java.util.List; - -import org.cbioportal.model.SingleCellExpression; -import org.cbioportal.persistence.SingleCellExpressionRepository; -import org.cbioportal.utils.SingleCellExpressionTestUtils; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; - -@RunWith(MockitoJUnitRunner.class) -public class SingleCellExpressionServiceImplTest { - - @InjectMocks - private SingleCellExpressionServiceImpl singleCellExpressionService; - @Mock - private SingleCellExpressionRepository singleCellExpressionRepository; - - - @Test - public void fetchSingleCellExpressionInMolecularProfile() throws Exception { - // List testSingleCellExpressionList = SingleCellExpressionTestUtils.createTestSingleCellExpressionList(); - // Mockito.when(singleCellExpressionRepository.fetchSingleCellExpressionInMolecularProfile( - // Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) - // .thenReturn(testSingleCellExpressionList); - // - // List result = singleCellExpressionService.fetchSingleCellExpressionInMolecularProfile(SingleCellExpressionTestUtils.TEST_MOLECULAR_PROFILE_ID_1, SingleCellExpressionTestUtils.TEST_SAMPLE_LIST_ID, - // List.of(SingleCellExpressionTestUtils.TEST_ENTREZ_GENE_ID_1), 1000, 0); - // - // - // Assert.assertEquals(testSingleCellExpressionList, result); - } - - @Test - public void fetchSingleCellExpressionInMolecularProfileGroupedBySample() throws Exception { - // TODO - } -} diff --git a/src/test/java/org/cbioportal/utils/SingleCellExpressionTestUtils.java b/src/test/java/org/cbioportal/utils/SingleCellExpressionTestUtils.java deleted file mode 100644 index 2d5b4570712..00000000000 --- a/src/test/java/org/cbioportal/utils/SingleCellExpressionTestUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.cbioportal.utils; - -import java.util.ArrayList; -import java.util.List; - -import org.cbioportal.model.SingleCellExpression; - -public final class SingleCellExpressionTestUtils { - - public static final String TEST_SAMPLE_LIST_ID = "test_sample_list_id"; - public static final String TEST_MOLECULAR_PROFILE_ID_1 = "test_molecular_profile_id_1"; - public static final String TEST_SAMPLE_ID_1 = "test_sample_id_1"; - public static final String TEST_PATIENT_ID_1 = "test_patient_id_1"; - public static final Integer TEST_ENTREZ_GENE_ID_1 = 1; - public static final String TEST_STUDY_ID_1 = "test_study_id_1"; - public static final String TEST_TISSUE_1 = "test_tissue_1"; - public static final String TEST_CELL_TYPE_1 = "test_cell_type_1"; - public static final Float TEST_EXPRESSION_VALUE_1 = 1.1f; - public static final String TEST_MOLECULAR_PROFILE_ID_2 = "test_molecular_profile_id_2"; - public static final String TEST_SAMPLE_ID_2 = "test_sample_id_2"; - public static final String TEST_PATIENT_ID_2 = "test_patient_id_2"; - public static final Integer TEST_ENTREZ_GENE_ID_2 = 2; - public static final String TEST_STUDY_ID_2 = "test_study_id_2"; - public static final String TEST_TISSUE_2 = "test_tissue_2"; - public static final String TEST_CELL_TYPE_2 = "test_cell_type_2"; - public static final Float TEST_EXPRESSION_VALUE_2 = 2.2f; - - public static List createTestSingleCellExpressionList() { - List singleCellExpressionList = new ArrayList<>(); - SingleCellExpression singleCellExpression1 = new SingleCellExpression(); - singleCellExpression1.setMolecularProfileId(TEST_MOLECULAR_PROFILE_ID_1); - singleCellExpression1.setSampleId(TEST_SAMPLE_ID_1); - singleCellExpression1.setPatientId(TEST_PATIENT_ID_1); - singleCellExpression1.setEntrezGeneId(TEST_ENTREZ_GENE_ID_1); - singleCellExpression1.setStudyId(TEST_STUDY_ID_1); - singleCellExpression1.setTissue(TEST_TISSUE_1); - singleCellExpression1.setCellType(TEST_CELL_TYPE_1); - singleCellExpression1.setExpressionValue(TEST_EXPRESSION_VALUE_1); - singleCellExpressionList.add(singleCellExpression1); - SingleCellExpression singleCellExpression2 = new SingleCellExpression(); - singleCellExpression2.setMolecularProfileId(TEST_MOLECULAR_PROFILE_ID_2); - singleCellExpression2.setSampleId(TEST_SAMPLE_ID_2); - singleCellExpression2.setPatientId(TEST_PATIENT_ID_2); - singleCellExpression2.setEntrezGeneId(TEST_ENTREZ_GENE_ID_2); - singleCellExpression2.setStudyId(TEST_STUDY_ID_2); - singleCellExpression2.setTissue(TEST_TISSUE_2); - singleCellExpression2.setCellType(TEST_CELL_TYPE_2); - singleCellExpression2.setExpressionValue(TEST_EXPRESSION_VALUE_2); - singleCellExpressionList.add(singleCellExpression2); - return singleCellExpressionList; - } -} diff --git a/src/test/java/org/cbioportal/web/SingleCellExpressionControllerTest.java b/src/test/java/org/cbioportal/web/SingleCellExpressionControllerTest.java deleted file mode 100644 index 0c2a4bc6682..00000000000 --- a/src/test/java/org/cbioportal/web/SingleCellExpressionControllerTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.cbioportal.web; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.math3.analysis.function.Sin; -import org.cbioportal.model.SingleCellExpression; -import org.cbioportal.service.SingleCellExpressionService; -import org.cbioportal.utils.SingleCellExpressionTestUtils; -import org.cbioportal.web.config.TestConfig; -import org.hamcrest.Matchers; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.result.MockMvcResultMatchers; - -@RunWith(SpringJUnit4ClassRunner.class) -@WebMvcTest -@ContextConfiguration(classes = {SingleCellExpressionController.class, TestConfig.class}) -public class SingleCellExpressionControllerTest { - - @MockBean - private SingleCellExpressionService singleCellExpressionService; - - @Autowired - private MockMvc mockMvc; - - @Test - @WithMockUser - public void fetchSingleCellExpressionDefaultProjection() throws Exception { - - // Mockito.when(singleCellExpressionService.fetchSingleCellExpressionInMolecularProfile( - // Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) - // .thenReturn(SingleCellExpressionTestUtils.createTestSingleCellExpressionList()); - // - // mockMvc.perform(MockMvcRequestBuilders.get("/api/molecular-profiles/test_molecular_profile_id/single-cell-expression") - // .param("sampleListId", SingleCellExpressionTestUtils.TEST_SAMPLE_LIST_ID) - // .accept(MediaType.APPLICATION_JSON)) - // .andExpect(MockMvcResultMatchers.status().isOk()) - // .andExpect(MockMvcResultMatchers.content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - // .andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.hasSize(2))) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].molecularProfileId") .value(SingleCellExpressionTestUtils.TEST_MOLECULAR_PROFILE_ID_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].sampleId").value(SingleCellExpressionTestUtils.TEST_SAMPLE_ID_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].patientId").value(SingleCellExpressionTestUtils.TEST_PATIENT_ID_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].entrezGeneId").value(SingleCellExpressionTestUtils.TEST_ENTREZ_GENE_ID_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].studyId").value(SingleCellExpressionTestUtils.TEST_STUDY_ID_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].tissue").value(SingleCellExpressionTestUtils.TEST_TISSUE_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].cellType").value(SingleCellExpressionTestUtils.TEST_CELL_TYPE_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].expressionValue").value(SingleCellExpressionTestUtils.TEST_EXPRESSION_VALUE_1)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[0].gene").doesNotExist()) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].molecularProfileId") .value(SingleCellExpressionTestUtils.TEST_MOLECULAR_PROFILE_ID_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].sampleId").value(SingleCellExpressionTestUtils.TEST_SAMPLE_ID_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].patientId").value(SingleCellExpressionTestUtils.TEST_PATIENT_ID_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].entrezGeneId").value(SingleCellExpressionTestUtils.TEST_ENTREZ_GENE_ID_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].studyId").value(SingleCellExpressionTestUtils.TEST_STUDY_ID_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].tissue").value(SingleCellExpressionTestUtils.TEST_TISSUE_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].cellType").value(SingleCellExpressionTestUtils.TEST_CELL_TYPE_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].expressionValue").value(SingleCellExpressionTestUtils.TEST_EXPRESSION_VALUE_2)) - // .andExpect(MockMvcResultMatchers.jsonPath("$[1].gene").doesNotExist()); - } - - @Test - @WithMockUser - public void fetchSingleCellExpressionGroupedBySampleDefaultProjection() throws Exception { - - } -}