JAL-1517 source formatting
[jalview.git] / test / jalview / ext / jmol / PDBFileWithJmolTest.java
index 2b53822..900e47c 100644 (file)
@@ -1,5 +1,22 @@
-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 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 jalview.ext.jmol;
 
@@ -7,13 +24,15 @@ import static org.junit.Assert.*;
 
 import java.util.Vector;
 
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
 
 import org.junit.Test;
 
 /**
  * @author jimp
- *
+ * 
  */
 public class PDBFileWithJmolTest
 {
@@ -21,11 +40,28 @@ public class PDBFileWithJmolTest
   @Test
   public void test() throws Exception
   {
-    PDBFileWithJmol jtest=new PDBFileWithJmol("./examples/1vsp", jalview.io.AppletFormatAdapter.FILE);
-    Vector<SequenceI> seqs=jtest.getSeqs();
-    assertTrue("No sequences extracted from testfile", seqs!=null && seqs.size()>0);
-    assertTrue("No annotation generated.", seqs.get(0).getAnnotation()!=null && seqs.get(0).getAnnotation().length!=0);
-    
+    PDBFileWithJmol jtest = new PDBFileWithJmol("./examples/1GAQ.txt",
+            jalview.io.AppletFormatAdapter.FILE);
+    Vector<SequenceI> seqs = jtest.getSeqs();
+
+    assertTrue(
+            "No sequences extracted from testfile\n"
+                    + (jtest.hasWarningMessage() ? jtest.getWarningMessage()
+                            : "(No warnings raised)"),
+            seqs != null && seqs.size() > 0);
+    for (SequenceI sq : seqs)
+    {
+      AlignmentI al = new Alignment(new SequenceI[]
+      { sq });
+      if (!al.isNucleotide())
+      {
+        assertTrue(
+                "No secondary structure assigned for protein sequence.",
+                sq.getAnnotation() != null
+                        && sq.getAnnotation().length >= 1
+                        && sq.getAnnotation()[0].hasIcons);
+      }
+    }
   }
 
 }