use of org.mskcc.oncotree.model.TumorType in project oncotree by cBioPortal.
the class CacheUtilTest method testGetTumorTypesByVersion.
@Test
public void testGetTumorTypesByVersion() {
Map<String, TumorType> returnedTumorTypes = cacheUtil.getTumorTypesByVersion(legacyVersion);
// there is only one node in returnedTumorTypes, and it is the TISSUE node, everything else is a child of that node
String rootTumorTypeCode = returnedTumorTypes.keySet().iterator().next();
TumorType rootTumorType = returnedTumorTypes.get(rootTumorTypeCode);
assertEquals("TISSUE", rootTumorTypeCode);
assertEquals("TISSUE", rootTumorType.getCode());
assertEquals(32, rootTumorType.getChildren().size());
// legacy version should have no history, no revocations, no precursors
assertNoHistoryInChildren(rootTumorType.getChildren());
assertNoRevocationsInChildren(rootTumorType.getChildren());
assertNoPrecursorsInChildren(rootTumorType.getChildren());
returnedTumorTypes = cacheUtil.getTumorTypesByVersion(latestVersion);
// test latest version has a history in one node
Boolean foundHistory = Boolean.FALSE;
foundHistory = assertHistoryInChildren(returnedTumorTypes, foundHistory);
assertTrue("Failed to find history for 'SS'", foundHistory);
// test revocations in latest version
Boolean foundRevocations = Boolean.FALSE;
foundRevocations = assertRevocationsInChildren(returnedTumorTypes, foundRevocations);
assertTrue("Failed to find revocations for 'URMM'", foundRevocations);
// test precursors in latest version
Boolean foundPrecursors = Boolean.FALSE;
foundPrecursors = assertPrecursorsInChildren(returnedTumorTypes, foundPrecursors);
assertTrue("Failed to find precursors for 'CLLSLL'", foundPrecursors);
}
use of org.mskcc.oncotree.model.TumorType in project oncotree by cBioPortal.
the class CacheUtilTest method assertNoHistoryInChildren.
private void assertNoHistoryInChildren(Map<String, TumorType> tumorTypes) {
for (TumorType tumorType : tumorTypes.values()) {
assertEquals("Node " + tumorType.getCode() + " name: " + tumorType.getName() + " has history", 0, tumorType.getHistory().size());
assertNoHistoryInChildren(tumorType.getChildren());
}
}
Aggregations