JAL-1759 merge from develop
[jalview.git] / test / MCview / PDBfileTest.java
index cce8634..1dfeba9 100644 (file)
@@ -6,10 +6,6 @@ import static org.testng.AssertJUnit.assertNull;
 import static org.testng.AssertJUnit.assertSame;
 import static org.testng.AssertJUnit.assertTrue;
 
-import java.io.IOException;
-
-import org.testng.annotations.Test;
-
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
@@ -18,9 +14,14 @@ import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
 import jalview.io.AppletFormatAdapter;
 
+import java.io.IOException;
+import java.util.List;
+
+import org.testng.annotations.Test;
+
 public class PDBfileTest
 {
-  @Test
+  @Test(groups ={ "Functional" })
   public void testIsRna()
   {
     SequenceI seq = new Sequence("Seq1", "CGAU");
@@ -42,7 +43,7 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testParse() throws IOException
   {
     /*
@@ -96,6 +97,21 @@ public class PDBfileTest
     assertTrue(chainD.sequence.getSequenceAsString().startsWith("ATYNVK"));
     assertTrue(chainD.sequence.getSequenceAsString().endsWith("KEEELT"));
     assertEquals("3W5V|D", chainD.sequence.getName());
+
+    /*
+     * verify PDB-related data in parsed sequences
+     */
+    List<SequenceI> seqs = pf.getSeqs();
+    assertEquals(4, seqs.size());
+    assertEquals("3W5V|A", seqs.get(0).getName());
+    assertEquals("3W5V|B", seqs.get(1).getName());
+    assertEquals("3W5V|C", seqs.get(2).getName());
+    assertEquals("3W5V|D", seqs.get(3).getName());
+    assertEquals(1, seqs.get(0).getPDBId().size());
+    PDBEntry pdbe = seqs.get(0).getPDBId().get(0);
+    assertEquals("A", pdbe.getChainCode());
+    assertEquals("3W5V", pdbe.getId());
+    assertEquals(PDBEntry.Type.PDB.toString(), pdbe.getType());
   }
 
   /**
@@ -104,7 +120,7 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testParse_withAnnotations_noSS() throws IOException
   {
     PDBfile pf = new PDBfile(true, false, false, "examples/3W5V.pdb",
@@ -162,7 +178,7 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testParse_withJmol_noAnnotations() throws IOException
   {
     PDBfile pf = new PDBfile(false, true, false, "examples/3W5V.pdb",
@@ -191,7 +207,7 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
+  @Test(groups ={ "Functional" })
   public void testParse_withJmolAddAlignmentAnnotations()
           throws IOException
   {
@@ -248,7 +264,8 @@ public class PDBfileTest
    * @throws IOException
    */
 
-  @Test(enabled = false)
+  @Test(groups =
+  { "Functional" }, enabled = false)
   public void testParse_withAnnotate3D() throws IOException
   {
     // TODO requires a mock for Annotate3D processing
@@ -265,7 +282,7 @@ public class PDBfileTest
   private AlignmentAnnotation[] getAlignmentAnnotations(PDBfile pf)
   {
     AlignmentI al = new Alignment(pf.getSeqsAsArray());
-    pf.addAnnotations((Alignment) al);
+    pf.addAnnotations(al);
     return al.getAlignmentAnnotation();
   }
   }