Skip to content
Snippets Groups Projects
Commit 1ec41e34 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

additional hgnc annotator tests

parent ec799ee1
No related branches found
No related tags found
1 merge request!4Additional unit tests
...@@ -281,7 +281,7 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService ...@@ -281,7 +281,7 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService
"Only " + MiriamType.HGNC + " and " + MiriamType.HGNC_SYMBOL + " are accepted but " + miriamData.getDataType() + " found."); "Only " + MiriamType.HGNC + " and " + MiriamType.HGNC_SYMBOL + " are accepted but " + miriamData.getDataType() + " found.");
} }
try { try {
List<MiriamData> result = new ArrayList<MiriamData>(); List<MiriamData> result = new ArrayList<>();
String content = getWebPageContent(query); String content = getWebPageContent(query);
Node xml = getXmlDocumentFromString(content); Node xml = getXmlDocumentFromString(content);
Node response = getNode("response", xml.getChildNodes()); Node response = getNode("response", xml.getChildNodes());
......
...@@ -94,6 +94,24 @@ public class HgncAnnotatorTest extends AnnotationTestFunctions { ...@@ -94,6 +94,24 @@ public class HgncAnnotatorTest extends AnnotationTestFunctions {
} }
} }
@Test
public void testGetAnnotationsForElementWithMultiHGNC() throws Exception {
try {
MiriamData snca = new MiriamData(MiriamType.HGNC_SYMBOL, "SNCA");
MiriamData park7 = new MiriamData(MiriamType.HGNC_SYMBOL, "PARK7");
GenericProtein proteinAlias = new GenericProtein("id");
proteinAlias.addMiriamData(snca);
proteinAlias.addMiriamData(park7);
hgncAnnotator.annotateElement(proteinAlias);
assertEquals(1, getWarnings().size());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test @Test
public void testGetAnnotationsForHGNC_ID() throws Exception { public void testGetAnnotationsForHGNC_ID() throws Exception {
try { try {
...@@ -290,6 +308,16 @@ public class HgncAnnotatorTest extends AnnotationTestFunctions { ...@@ -290,6 +308,16 @@ public class HgncAnnotatorTest extends AnnotationTestFunctions {
} }
} }
@Test
public void testUnknownHgncIdToName() throws Exception {
try {
assertNull(hgncAnnotator.hgncIdToHgncName(new MiriamData(MiriamType.HGNC, "asd")));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test @Test
public void testHgncToUniProt1() throws Exception { public void testHgncToUniProt1() throws Exception {
try { try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment