From: jprocter Date: Fri, 18 Jan 2013 15:56:36 +0000 (+0000) Subject: JAL-1238 test to see if the primary Uniprot source is placed first in list of Uniprot... X-Git-Tag: Jalview_2_9~253^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=35229a3e24b054cc6f3a0a0903a61fc6f6462b6e;p=jalview.git JAL-1238 test to see if the primary Uniprot source is placed first in list of Uniprot sources --- diff --git a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java new file mode 100644 index 0000000..2f826b3 --- /dev/null +++ b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java @@ -0,0 +1,78 @@ +/** + * + */ +package jalview.ws.seqfetcher; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import jalview.datamodel.DBRefSource; +import jalview.ws.DBRefFetcher; +import jalview.ws.SequenceFetcher; +import jalview.ws.dbsources.das.api.jalviewSourceI; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * @author jimp + * + */ +public class DbRefFetcherTest +{ + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception + { + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception + { + } + + @Test + public void testStandardProtDbs() + { + String[] defdb = DBRefSource.PROTEINDBS; + List srces = new ArrayList(); + for (String ddb : defdb) + { + SequenceFetcher sfetcher= new SequenceFetcher(); + List srcesfordb = sfetcher.getSourceProxy(ddb); + + if (srcesfordb != null) + { + srces.addAll(srcesfordb); + } + } + DbSourceProxy uniprot=null; + int i=0; + // append the selected sequence sources to the default dbs + for (DbSourceProxy s:srces) + { + if (s.getDbSource().equalsIgnoreCase(DBRefSource.UNIPROT)) + { + i++; + } + + if (s instanceof jalview.ws.dbsources.Uniprot) + { + uniprot = s; + break; + } + } + + assertTrue("Failed to find Uniprot source as first source amongst "+srces.size()+" sources (source was at position "+i+")", uniprot!=null && i<2); + } + +}