JAL-2114 explicit invalid test cases added
[jalview.git] / test / jalview / ext / ensembl / EnsemblProteinTest.java
1 package jalview.ext.ensembl;
2
3 import static org.testng.AssertJUnit.assertEquals;
4
5 import org.testng.Assert;
6 import org.testng.annotations.Test;
7
8 public class EnsemblProteinTest
9 {
10
11   @Test(groups = "Functional")
12   public void testIsValidReference() throws Exception
13   {
14     EnsemblSequenceFetcher esq = new EnsemblProtein();
15     Assert.assertTrue(esq.isValidReference("CCDS5863.1"));
16     Assert.assertTrue(esq.isValidReference("ENSP00000288602"));
17     Assert.assertFalse(esq.isValidReference("ENST00000288602"));
18     Assert.assertFalse(esq.isValidReference("ENSG00000288602"));
19     // non-human species having a 3 character identifier included:
20     Assert.assertTrue(esq.isValidReference("ENSMUSP00000099398"));
21   }
22
23   @Test(groups = "Functional")
24   public void testGetAccesionIdFromQuery() throws Exception
25   {
26     EnsemblSequenceFetcher esq = new EnsemblProtein();
27     assertEquals("ENSP00000288602",
28             esq.getAccessionIdFromQuery("ENSP00000288602"));
29     assertEquals("ENSMUSP00000288602",
30             esq.getAccessionIdFromQuery("ENSMUSP00000288602"));
31
32     // ENST converted to ENSP
33     assertEquals("ENSP00000288602",
34             esq.getAccessionIdFromQuery("ENST00000288602"));
35     assertEquals("ENSMUSP00000288602",
36             esq.getAccessionIdFromQuery("ENSMUST00000288602"));
37
38     // with valid separator:
39     assertEquals("ENSP00000288604",
40             esq.getAccessionIdFromQuery("ENSP00000288604 ENSP00000288602"));
41
42     // with wrong separator:
43     assertEquals("ENSP00000288604,ENSP00000288602",
44             esq.getAccessionIdFromQuery("ENSP00000288604,ENSP00000288602"));
45   }
46
47 }