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

whitespace is removed from pubmed reference

parent 532c1b30
No related branches found
No related tags found
2 merge requests!541version 12.1.3 into master,!516Resolve "Searching for some drugs results in an internal server error"
...@@ -330,7 +330,7 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService { ...@@ -330,7 +330,7 @@ public class ChEMBLParser extends DrugAnnotation implements IExternalService {
Node typeNode = super.getNode("ref_type", node); Node typeNode = super.getNode("ref_type", node);
if ("PubMed".equalsIgnoreCase(typeNode.getTextContent())) { if ("PubMed".equalsIgnoreCase(typeNode.getTextContent())) {
Node idNode = super.getNode("ref_id", node); Node idNode = super.getNode("ref_id", node);
String id = idNode.getTextContent(); String id = idNode.getTextContent().trim();
result.add(new MiriamData(MiriamType.PUBMED, id)); result.add(new MiriamData(MiriamType.PUBMED, id));
} }
} else { } else {
......
...@@ -1113,6 +1113,19 @@ public class ChEMBLParserTest extends AnnotationTestFunctions { ...@@ -1113,6 +1113,19 @@ public class ChEMBLParserTest extends AnnotationTestFunctions {
} }
} }
@Test
public void testParseReferencesWithSpecInId() throws Exception {
try {
Node node = super.getXmlDocumentFromFile("testFiles/chembl/references_with_space.xml");
Set<MiriamData> references = chemblParser.parseReferences(node.getFirstChild());
assertEquals(1, references.size());
assertFalse(references.iterator().next().getResource().contains(" "));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
@Test @Test
public void testMoreThanOneDrugByName() throws Exception { public void testMoreThanOneDrugByName() 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