Skip to content

Commit

Permalink
Use static imports for asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslan-forostianov committed Apr 5, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 8e49ff5 commit 257d2a5
Showing 4 changed files with 19 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@

package org.mskcc.cbio.portal.integrationTest.dao;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mskcc.cbio.portal.dao.DaoCancerStudy;
@@ -71,7 +70,7 @@ public class TestDaoCancerStudy {
@Test
public void testDaoCancerStudy() throws DaoException, IOException {

Assert.assertEquals("Breast Invasive Carcinoma", DaoTypeOfCancer.getTypeOfCancerById("BRCA").getName());
assertEquals("Breast Invasive Carcinoma", DaoTypeOfCancer.getTypeOfCancerById("BRCA").getName());

CancerStudy cancerStudy = new CancerStudy("GBM", "GBM Description", "gbm", "brca", false);
cancerStudy.setReferenceGenome("hg19");
Original file line number Diff line number Diff line change
@@ -33,7 +33,6 @@
package org.mskcc.cbio.portal.integrationTest.dao;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -58,7 +57,9 @@
import java.util.Map;
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* JUnit tests for DaoMutation class.
@@ -223,23 +224,23 @@ private void validateMockAnnotationJson(ExtendedMutation mutation) {
Map<String, Map<String, String>> expectedAnnotationJsonMap = makeMockExpectedAnnotationJsonMap();

// confirm expected sizes
Assert.assertTrue(annotationJsonMap.containsKey("namespace1"));
Assert.assertEquals(expectedAnnotationJsonMap.get("namespace1").size(), annotationJsonMap.get("namespace1").size());
Assert.assertEquals(2, annotationJsonMap.get("namespace1").size());
Assert.assertTrue(annotationJsonMap.containsKey("namespace2"));
Assert.assertEquals(1, annotationJsonMap.get("namespace2").size());
Assert.assertEquals(expectedAnnotationJsonMap.get("namespace2").size(), annotationJsonMap.get("namespace2").size());
assertTrue(annotationJsonMap.containsKey("namespace1"));
assertEquals(expectedAnnotationJsonMap.get("namespace1").size(), annotationJsonMap.get("namespace1").size());
assertEquals(2, annotationJsonMap.get("namespace1").size());
assertTrue(annotationJsonMap.containsKey("namespace2"));
assertEquals(1, annotationJsonMap.get("namespace2").size());
assertEquals(expectedAnnotationJsonMap.get("namespace2").size(), annotationJsonMap.get("namespace2").size());

// compare namespace 1 annotation map values
Map<String, String> namespace1Map = annotationJsonMap.get("namespace1");
Map<String, String> expectedNamespace1Map = expectedAnnotationJsonMap.get("namespace1");
Assert.assertEquals(expectedNamespace1Map.get("header1"), namespace1Map.get("header1"));
Assert.assertEquals(expectedNamespace1Map.get("header2"), namespace1Map.get("header2"));
assertEquals(expectedNamespace1Map.get("header1"), namespace1Map.get("header1"));
assertEquals(expectedNamespace1Map.get("header2"), namespace1Map.get("header2"));

// compare namespace 2 annotation map values
Map<String, String> namespace2Map = annotationJsonMap.get("namespace2");
Map<String, String> expectedNamespace2Map = expectedAnnotationJsonMap.get("namespace2");
Assert.assertEquals(expectedNamespace2Map.get("header1"), namespace2Map.get("header1"));
assertEquals(expectedNamespace2Map.get("header1"), namespace2Map.get("header1"));
}

private String makeMockAnnotationJsonString() {
Original file line number Diff line number Diff line change
@@ -70,6 +70,7 @@
import static org.cbioportal.model.MolecularProfile.DataType.DISCRETE;
import static org.cbioportal.model.MolecularProfile.ImportType.DISCRETE_LONG;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(SpringJUnit4ClassRunner.class)
@@ -579,8 +580,8 @@ private void assertSampleExistsInGeneticProfile(String sampleId) throws DaoExcep
geneticProfile.getCancerStudyId(),
sampleStableId
);
Assert.assertNotNull(sample);
Assert.assertTrue(DaoSampleProfile.sampleExistsInGeneticProfile(
assertNotNull(sample);
assertTrue(DaoSampleProfile.sampleExistsInGeneticProfile(
sample.getInternalId(),
geneticProfile.getGeneticProfileId()
));
Original file line number Diff line number Diff line change
@@ -33,12 +33,12 @@
package org.mskcc.cbio.portal.scripts;

import org.junit.Test;
import org.mskcc.cbio.portal.scripts.CutInvalidCases;

import static org.junit.Assert.*;

import java.io.File;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;

/**
* JUnit test for CutInvalidCases class.
*/

0 comments on commit 257d2a5

Please sign in to comment.