X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2FMCview%2FPDBfileTest.java;h=31c3beb76d1f990eb1be670b67913ef0aec99f57;hb=6d7ab37f37b09174ec61fee301aed6057ef86605;hp=5d69a00fe3f69b97a302d9f73e0690cd7dd409de;hpb=3de63f1530eb6fb6bca7996fe5e2002af3c811e9;p=jalview.git
diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java
index 5d69a00..31c3beb 100644
--- a/test/MCview/PDBfileTest.java
+++ b/test/MCview/PDBfileTest.java
@@ -1,10 +1,31 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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 .
+ * 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 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;
import jalview.datamodel.AlignmentI;
@@ -14,13 +35,13 @@ import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
import java.io.IOException;
+import java.util.List;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.testng.annotations.Test;
public class PDBfileTest
{
- @Test
+ @Test(groups = { "Functional" })
public void testIsRna()
{
SequenceI seq = new Sequence("Seq1", "CGAU");
@@ -42,7 +63,7 @@ public class PDBfileTest
*
* @throws IOException
*/
- @Test
+ @Test(groups = { "Functional" })
public void testParse() throws IOException
{
/*
@@ -51,17 +72,17 @@ public class PDBfileTest
PDBfile pf = new PDBfile(false, false, false, "examples/3W5V.pdb",
AppletFormatAdapter.FILE);
- assertEquals("3W5V", pf.id);
+ assertEquals("3W5V", pf.getId());
// verify no alignment annotations created
assertNull(getAlignmentAnnotations(pf));
- assertEquals(4, pf.chains.size());
- assertEquals("A", pf.chains.get(0).id);
- assertEquals("B", pf.chains.get(1).id);
- assertEquals("C", pf.chains.get(2).id);
- assertEquals("D", pf.chains.get(3).id);
+ assertEquals(4, pf.getChains().size());
+ assertEquals("A", pf.getChains().get(0).id);
+ assertEquals("B", pf.getChains().get(1).id);
+ assertEquals("C", pf.getChains().get(2).id);
+ assertEquals("D", pf.getChains().get(3).id);
- PDBChain chainA = pf.chains.get(0);
+ PDBChain chainA = pf.getChains().get(0);
assertEquals(0, chainA.seqstart); // not set
assertEquals(0, chainA.seqend); // not set
assertEquals(18, chainA.sequence.getStart());
@@ -70,32 +91,47 @@ 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());
- PDBChain chainB = pf.chains.get(1);
+ PDBChain chainB = pf.getChains().get(1);
assertEquals(1, chainB.sequence.getStart());
assertEquals(96, chainB.sequence.getEnd());
assertTrue(chainB.sequence.getSequenceAsString().startsWith("ATYNVK"));
assertTrue(chainB.sequence.getSequenceAsString().endsWith("KEEELT"));
assertEquals("3W5V|B", chainB.sequence.getName());
- PDBChain chainC = pf.chains.get(2);
+ PDBChain chainC = pf.getChains().get(2);
assertEquals(18, chainC.sequence.getStart());
assertEquals(314, chainC.sequence.getEnd());
assertTrue(chainC.sequence.getSequenceAsString().startsWith("KCSKKQEE"));
assertTrue(chainC.sequence.getSequenceAsString().endsWith("WNVEVY"));
assertEquals("3W5V|C", chainC.sequence.getName());
- PDBChain chainD = pf.chains.get(3);
+ PDBChain chainD = pf.getChains().get(3);
assertEquals(1, chainD.sequence.getStart());
assertEquals(96, chainD.sequence.getEnd());
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 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());
}
/**
@@ -104,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",
@@ -162,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",
@@ -179,7 +215,7 @@ public class PDBfileTest
* no sequence annotations created - tempFactor annotation is not added
* unless the flag to 'addAlignmentAnnotations' is set true
*/
- for (PDBChain c : pf.chains)
+ for (PDBChain c : pf.getChains())
{
assertNull(c.sequence.getAnnotation());
}
@@ -191,7 +227,7 @@ public class PDBfileTest
*
* @throws IOException
*/
- @Test
+ @Test(groups = { "Functional" })
public void testParse_withJmolAddAlignmentAnnotations()
throws IOException
{
@@ -247,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
@@ -256,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
*
@@ -265,7 +302,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();
}
- }
+}