JAL-1894 update year/version in copyright
[jalview.git] / test / MCview / PDBfileTest.java
index 9ebed25..9427cd2 100644 (file)
@@ -1,15 +1,30 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b1)
+ * Copyright (C) 2015 The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package MCview;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.junit.Ignore;
-import org.junit.Test;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertSame;
+import static org.testng.AssertJUnit.assertTrue;
 
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
@@ -19,9 +34,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");
@@ -43,7 +63,7 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
+  @Test(groups = { "Functional" })
   public void testParse() throws IOException
   {
     /*
@@ -71,8 +91,8 @@ public class PDBfileTest
     assertTrue(chainA.sequence.getSequenceAsString().endsWith("WNVEVY"));
     assertEquals("3W5V|A", chainA.sequence.getName());
     assertNull(chainA.sequence.getAnnotation());
-    assertEquals(1, chainA.sequence.getPDBId().size());
-    PDBEntry pdb = chainA.sequence.getPDBId().get(0);
+    assertEquals(1, chainA.sequence.getAllPDBEntries().size());
+    PDBEntry pdb = chainA.sequence.getAllPDBEntries().get(0);
     assertEquals("A", pdb.getChainCode());
     assertEquals("PDB", pdb.getType());
     assertEquals("3W5V", pdb.getId());
@@ -97,6 +117,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).getAllPDBEntries().size());
+    PDBEntry pdbe = seqs.get(0).getAllPDBEntries().get(0);
+    assertEquals("A", pdbe.getChainCode());
+    assertEquals("3W5V", pdbe.getId());
+    assertEquals(PDBEntry.Type.PDB.toString(), pdbe.getType());
   }
 
   /**
@@ -105,7 +140,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",
@@ -163,7 +198,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",
@@ -192,7 +227,7 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
+  @Test(groups = { "Functional" })
   public void testParse_withJmolAddAlignmentAnnotations()
           throws IOException
   {
@@ -248,8 +283,8 @@ public class PDBfileTest
    * 
    * @throws IOException
    */
-  @Test
-  @Ignore
+
+  @Test(groups = { "Functional" }, enabled = false)
   public void testParse_withAnnotate3D() throws IOException
   {
     // TODO requires a mock for Annotate3D processing
@@ -257,6 +292,7 @@ public class PDBfileTest
     PDBfile pf = new PDBfile(true, true, true, "examples/2GIS.pdb",
             AppletFormatAdapter.FILE);
   }
+
   /**
    * Helper method to extract parsed annotations from the PDBfile
    * 
@@ -269,4 +305,4 @@ public class PDBfileTest
     pf.addAnnotations(al);
     return al.getAlignmentAnnotation();
   }
-  }
+}