JAL-1213 JAL-674 robust test with an existing structure in the examples directory
[jalview.git] / test / jalview / ext / jmol / PDBFileWithJmolTest.java
1 /**
2  * 
3  */
4 package jalview.ext.jmol;
5
6 import static org.junit.Assert.*;
7
8 import java.util.Vector;
9
10 import jalview.datamodel.Alignment;
11 import jalview.datamodel.AlignmentI;
12 import jalview.datamodel.SequenceI;
13
14 import org.junit.Test;
15
16 /**
17  * @author jimp
18  *
19  */
20 public class PDBFileWithJmolTest
21 {
22
23   @Test
24   public void test() throws Exception
25   {
26     PDBFileWithJmol jtest=new PDBFileWithJmol("./examples/1GAQ.txt", jalview.io.AppletFormatAdapter.FILE);
27     Vector<SequenceI> seqs=jtest.getSeqs();
28     
29     assertTrue("No sequences extracted from testfile\n"+(jtest.hasWarningMessage() ? jtest.getWarningMessage(): "(No warnings raised)"), seqs!=null && seqs.size()>0);
30     for (SequenceI sq:seqs)
31     {
32       AlignmentI al = new Alignment(new SequenceI[] { sq});
33       if (!al.isNucleotide())
34       {
35         assertTrue("No secondary structure assigned for protein sequence.",sq.getAnnotation()!=null && sq.getAnnotation().length>=1 && sq.getAnnotation()[0].hasIcons);
36       }
37     }
38   }
39
40 }