diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/MultipleAnnotatorsTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/MultipleAnnotatorsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..27c802a421de0faf6bbec7666ddb761fa20ed4af --- /dev/null +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/MultipleAnnotatorsTest.java @@ -0,0 +1,82 @@ +package lcsb.mapviewer.annotation.services.annotators; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; + +import lcsb.mapviewer.annotation.AnnotationTestFunctions; +import lcsb.mapviewer.annotation.cache.WebPageDownloader; +import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.species.GenericProtein; +import lcsb.mapviewer.model.map.species.Species; + +public class MultipleAnnotatorsTest extends AnnotationTestFunctions { + + @Autowired + KeggAnnotator keggAnnotator; + + @Autowired + UniprotAnnotator uniprotAnnotator; + + @Autowired + HgncAnnotator hgncAnnotator; + + @Autowired + BiocompendiumAnnotator biocompendiumAnnotator; + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testAnnotateUniprotByUniprotAndKegg() throws Exception { + try { + + Species protein = new GenericProtein("id"); + protein.setName("bla"); + protein.addMiriamData(new MiriamData(MiriamType.UNIPROT, "P12345")); + + keggAnnotator.annotateElement(protein); + uniprotAnnotator.annotateElement(protein); + hgncAnnotator.annotateElement(protein); + //biocompendiumAnnotator.annotateElement(protein); + + + int cntNoAnnotator = 0; + for (MiriamData md: protein.getMiriamData()) { + if (md.getAnnotator() == null) { + cntNoAnnotator++; + } + } + + assertTrue("Wrong number of annotated elements with no information about annotator", cntNoAnnotator == 1); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +}