diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java index 1e91d082ae1df4a91a6c1855b36109641833290b..5be797e15a4294818c37843d781af032e9307f0a 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java @@ -281,7 +281,7 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService "Only " + MiriamType.HGNC + " and " + MiriamType.HGNC_SYMBOL + " are accepted but " + miriamData.getDataType() + " found."); } try { - List<MiriamData> result = new ArrayList<MiriamData>(); + List<MiriamData> result = new ArrayList<>(); String content = getWebPageContent(query); Node xml = getXmlDocumentFromString(content); Node response = getNode("response", xml.getChildNodes()); diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java index 513947ca97451dea0981ab8c158b9e3855a99220..93bdc0c0356fde7ef3eb0babd0c42cf7a73fbbdb 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java @@ -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 public void testGetAnnotationsForHGNC_ID() throws Exception { try { @@ -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 public void testHgncToUniProt1() throws Exception { try {