X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=test%2FMCview%2FPDBChainTest.java;h=ff745ac3bf34a3833f321b114911e44256eb428e;hb=203a256b7870f70a873e7795602755fb17c3c99f;hp=5be43b3808de2070fc37cc36541839fe18cc9949;hpb=c777b335d0332979123446f431b7f0c160eb4880;p=jalview.git
diff --git a/test/MCview/PDBChainTest.java b/test/MCview/PDBChainTest.java
index 5be43b3..ff745ac 100644
--- a/test/MCview/PDBChainTest.java
+++ b/test/MCview/PDBChainTest.java
@@ -1,14 +1,29 @@
+/*
+ * 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.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.awt.Color;
-import java.util.Vector;
-
-import org.junit.Test;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertSame;
+import static org.testng.AssertJUnit.assertTrue;
import jalview.analysis.AlignSeq;
import jalview.datamodel.AlignmentAnnotation;
@@ -17,19 +32,35 @@ import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.TaylorColourScheme;
+import jalview.structure.StructureViewSettings;
+
+import java.awt.Color;
+import java.util.Vector;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
public class PDBChainTest
{
- PDBChain c = new PDBChain("1GAQ", "A");
- Atom a1 = new Atom(1f, 2f, 3f);
+ PDBChain c;
+
+ final Atom a1 = new Atom(1f, 2f, 3f);
- Atom a2 = new Atom(5f, 6f, 4f);
+ final Atom a2 = new Atom(5f, 6f, 4f);
- Atom a3 = new Atom(2f, 5f, 6f);
+ final Atom a3 = new Atom(2f, 5f, 6f);
- Atom a4 = new Atom(2f, 1f, 7f);
+ final Atom a4 = new Atom(2f, 1f, 7f);
- @Test
+ @BeforeMethod(alwaysRun = true)
+ public void setUp()
+ {
+ System.out.println("setup");
+ StructureViewSettings.setShowSeqFeatures(true);
+ c = new PDBChain("1GAQ", "A");
+ }
+
+ @Test(groups = { "Functional" })
public void testGetNewlineString()
{
assertEquals(System.lineSeparator(), c.getNewlineString());
@@ -37,7 +68,7 @@ public class PDBChainTest
assertEquals("gaga", c.getNewlineString());
}
- @Test
+ @Test(groups = { "Functional" })
public void testPrint()
{
c.offset = 7;
@@ -65,7 +96,7 @@ public class PDBChainTest
* Test the method that constructs a Bond between two atoms and adds it to the
* chain's list of bonds
*/
- @Test
+ @Test(groups = { "Functional" })
public void testMakeBond()
{
/*
@@ -100,7 +131,7 @@ public class PDBChainTest
assertEquals(3f, b2.end[2], 0.0001f);
}
- @Test
+ @Test(groups = { "Functional" })
public void testSetChainColours_colour()
{
c.makeBond(a1, a2);
@@ -117,7 +148,7 @@ public class PDBChainTest
* Test setting bond start/end colours based on a colour scheme i.e. colour by
* residue
*/
- @Test
+ @Test(groups = { "Functional" })
public void testSetChainColours_colourScheme()
{
Color alaColour = new Color(204, 255, 0);
@@ -145,7 +176,7 @@ public class PDBChainTest
assertEquals(Color.gray, b.endCol);
}
- @Test
+ @Test(groups = { "Functional" })
public void testGetChargeColour()
{
assertEquals(Color.red, PDBChain.getChargeColour("ASP"));
@@ -160,7 +191,7 @@ public class PDBChainTest
/**
* Test the method that sets bond start/end colours by residue charge property
*/
- @Test
+ @Test(groups = { "Functional" })
public void testSetChargeColours()
{
a1.resName = "ASP"; // red
@@ -189,7 +220,7 @@ public class PDBChainTest
/**
* Test the method that converts the raw list of atoms to a list of residues
*/
- @Test
+ @Test(groups = { "Functional" })
public void testMakeResidueList_noAnnotation()
{
Vector atoms = new Vector();
@@ -247,35 +278,35 @@ public class PDBChainTest
* Test the method that converts the raw list of atoms to a list of residues,
* including parsing of tempFactor to an alignment annotation
*/
- @Test
+ @Test(groups = { "Functional" })
public void testMakeResidueList_withTempFactor()
{
Vector atoms = new Vector();
c.atoms = atoms;
atoms.add(makeAtom(4, "N", "MET"));
- atoms.get(atoms.size()-1).tfactor = 1f;
+ atoms.get(atoms.size() - 1).tfactor = 1f;
atoms.add(makeAtom(4, "CA", "MET"));
- atoms.get(atoms.size()-1).tfactor = 2f;
+ atoms.get(atoms.size() - 1).tfactor = 2f;
atoms.add(makeAtom(4, "C", "MET"));
- atoms.get(atoms.size()-1).tfactor = 3f;
+ atoms.get(atoms.size() - 1).tfactor = 3f;
atoms.add(makeAtom(5, "O", "LYS"));
- atoms.get(atoms.size()-1).tfactor = 7f;
+ atoms.get(atoms.size() - 1).tfactor = 7f;
atoms.add(makeAtom(5, "N", "LYS"));
- atoms.get(atoms.size()-1).tfactor = 8f;
+ atoms.get(atoms.size() - 1).tfactor = 8f;
atoms.add(makeAtom(5, "CA", "LYS"));
- atoms.get(atoms.size()-1).tfactor = 9f;
+ atoms.get(atoms.size() - 1).tfactor = 9f;
atoms.add(makeAtom(6, "O", "LEU"));
- atoms.get(atoms.size()-1).tfactor = 4f;
+ atoms.get(atoms.size() - 1).tfactor = 4f;
atoms.add(makeAtom(6, "N", "LEU"));
- atoms.get(atoms.size()-1).tfactor = 5f;
+ atoms.get(atoms.size() - 1).tfactor = 5f;
atoms.add(makeAtom(6, "CA", "LEU"));
- atoms.get(atoms.size()-1).tfactor = 6f;
-
+ atoms.get(atoms.size() - 1).tfactor = 6f;
+
/*
* make residues including temp factor annotation
*/
c.makeResidueList(true);
-
+
/*
* Verify annotations; note the tempFactor is read from the first atom in
* each residue i.e. we expect values 1, 7, 4 for the residues
@@ -298,7 +329,7 @@ public class PDBChainTest
* Test the method that constructs bonds between successive residues' CA or P
* atoms
*/
- @Test
+ @Test(groups = { "Functional" })
public void testMakeCaBondList()
{
c.isNa = true;
@@ -329,7 +360,7 @@ public class PDBChainTest
assertTrue(c.isNa);
}
- @Test
+ @Test(groups = { "Functional" })
public void testMakeCaBondList_nucleotide()
{
c.isNa = false;
@@ -361,7 +392,7 @@ public class PDBChainTest
/**
* Test the method that updates atoms with their alignment positions
*/
- @Test
+ @Test(groups = { "Functional" })
public void testMakeExactMapping()
{
Vector atoms = new Vector();