develop merge
[jalview.git] / test / jalview / ws / dbsources / UniprotTest.java
index 7e387bd..ed3ac77 100644 (file)
@@ -89,19 +89,19 @@ public class UniprotTest
     assertEquals("signal peptide", sf.getType());
     assertNull(sf.getDescription());
     assertNull(sf.getStatus());
-    assertEquals(1, sf.getPosition()); // wrong - Castor bug??
+    assertEquals(1, sf.getPosition());
     assertEquals(1, sf.getBegin());
     assertEquals(18, sf.getEnd());
     sf = features.get(1);
     assertEquals("propeptide", sf.getType());
     assertEquals("Activation peptide", sf.getDescription());
-    assertEquals(19, sf.getPosition()); // wrong - Castor bug??
+    assertEquals(19, sf.getPosition());
     assertEquals(19, sf.getBegin());
     assertEquals(20, sf.getEnd());
     sf = features.get(2);
     assertEquals("chain", sf.getType());
     assertEquals("Granzyme B", sf.getDescription());
-    assertEquals(21, sf.getPosition()); // wrong - Castor bug??
+    assertEquals(21, sf.getPosition());
     assertEquals(21, sf.getBegin());
     assertEquals(247, sf.getEnd());
 
@@ -125,22 +125,34 @@ public class UniprotTest
   }
 
   /**
-   * Test the method that formats the sequence name in Fasta style
+   * Test the method that formats the sequence id
    */
   @Test(groups = { "Functional" })
-  public void testConstructSequenceFastaHeader()
+  public void testGetUniprotEntryId()
   {
-    Uniprot u = new Uniprot();
-    Reader reader = new StringReader(UNIPROT_XML);
-    Vector<UniprotEntry> entries = u.getUniprotEntries(reader);
-    UniprotEntry entry = entries.get(0);
+    UniprotEntry entry = new Uniprot().getUniprotEntries(
+            new StringReader(UNIPROT_XML)).get(0);
 
-    // source + accession ids + names
+    /*
+     * name formatted as source | accession ids | names
+     */
     String expectedName = "UniProt/Swiss-Prot|A9CKP4|A9CKP5|A9CKP4_AGRT5|A9CKP4_AGRT6";
-    // protein names
-    String expectedDescription = "Mitogen-activated protein kinase 13 Henry ";
-
     assertEquals(expectedName, Uniprot.getUniprotEntryId(entry));
+  }
+
+  /**
+   * Test the method that formats the sequence description
+   */
+  @Test(groups = { "Functional" })
+  public void testGetUniprotEntryDescription()
+  {
+    UniprotEntry entry = new Uniprot().getUniprotEntries(
+            new StringReader(UNIPROT_XML)).get(0);
+  
+    /*
+     * recommended names concatenated with space separator
+     */
+    String expectedDescription = "Mitogen-activated protein kinase 13 Henry";
     assertEquals(expectedDescription,
             Uniprot.getUniprotEntryDescription(entry));
   }