X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2FMCview%2FPDBChainTest.java;h=533c0af018c60bea104569b37f77b8705240b72b;hb=0a2ad6130c075b62eab8594d29a86eddd9f765a8;hp=ce020c9bc1e5c2464716a4a002de50ffab77025b;hpb=838e4f91d4a53dd315640dbc9ff6ef7a815ee576;p=jalview.git diff --git a/test/MCview/PDBChainTest.java b/test/MCview/PDBChainTest.java index ce020c9..533c0af 100644 --- a/test/MCview/PDBChainTest.java +++ b/test/MCview/PDBChainTest.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b1) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -30,17 +30,29 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.gui.JvOptionPane; import jalview.schemes.ColourSchemeI; import jalview.schemes.TaylorColourScheme; +import jalview.structure.StructureImportSettings; import java.awt.Color; +import java.util.List; import java.util.Vector; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PDBChainTest { + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + PDBChain c; final Atom a1 = new Atom(1f, 2f, 3f); @@ -55,6 +67,7 @@ public class PDBChainTest public void setUp() { System.out.println("setup"); + StructureImportSettings.setShowSeqFeatures(true); c = new PDBChain("1GAQ", "A"); } @@ -78,7 +91,7 @@ public class PDBChainTest a3.resName = "ASP"; a3.resNumber = 41; - Vector v = new Vector(); + Vector v = new Vector<>(); v.add(new Bond(a1, a2)); v.add(new Bond(a2, a3)); v.add(new Bond(a3, a1)); @@ -221,7 +234,7 @@ public class PDBChainTest @Test(groups = { "Functional" }) public void testMakeResidueList_noAnnotation() { - Vector atoms = new Vector(); + Vector atoms = new Vector<>(); c.atoms = atoms; c.isNa = true; atoms.add(makeAtom(4, "N", "MET")); @@ -246,19 +259,19 @@ public class PDBChainTest /* * check sequence features */ - SequenceFeature[] sfs = c.sequence.getSequenceFeatures(); - assertEquals(3, sfs.length); - assertEquals("RESNUM", sfs[0].type); - assertEquals("MET:4 1gaqA", sfs[0].description); - assertEquals(4, sfs[0].begin); - assertEquals(4, sfs[0].end); - assertEquals("RESNUM", sfs[0].type); - assertEquals("LYS:5 1gaqA", sfs[1].description); - assertEquals(5, sfs[1].begin); - assertEquals(5, sfs[1].end); - assertEquals("LEU:6 1gaqA", sfs[2].description); - assertEquals(6, sfs[2].begin); - assertEquals(6, sfs[2].end); + List sfs = c.sequence.getSequenceFeatures(); + assertEquals(3, sfs.size()); + assertEquals("RESNUM", sfs.get(0).type); + assertEquals("MET:4 1gaqA", sfs.get(0).description); + assertEquals(4, sfs.get(0).begin); + assertEquals(4, sfs.get(0).end); + assertEquals("RESNUM", sfs.get(0).type); + assertEquals("LYS:5 1gaqA", sfs.get(1).description); + assertEquals(5, sfs.get(1).begin); + assertEquals(5, sfs.get(1).end); + assertEquals("LEU:6 1gaqA", sfs.get(2).description); + assertEquals(6, sfs.get(2).begin); + assertEquals(6, sfs.get(2).end); } private Atom makeAtom(int resnum, String name, String resname) @@ -279,7 +292,7 @@ public class PDBChainTest @Test(groups = { "Functional" }) public void testMakeResidueList_withTempFactor() { - Vector atoms = new Vector(); + Vector atoms = new Vector<>(); c.atoms = atoms; atoms.add(makeAtom(4, "N", "MET")); atoms.get(atoms.size() - 1).tfactor = 1f; @@ -294,7 +307,7 @@ public class PDBChainTest atoms.add(makeAtom(5, "CA", "LYS")); 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.add(makeAtom(6, "CA", "LEU")); @@ -307,7 +320,7 @@ public class PDBChainTest /* * 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 + * each residue i.e. we expect values 1, 7, -4 for the residues */ AlignmentAnnotation[] ann = c.sequence.getAnnotation(); assertEquals(1, ann.length); @@ -315,12 +328,12 @@ public class PDBChainTest assertEquals("Temperature Factor for 1gaqA", ann[0].description); assertSame(c.sequence, ann[0].sequenceRef); assertEquals(AlignmentAnnotation.LINE_GRAPH, ann[0].graph); - assertEquals(0f, ann[0].graphMin, 0.001f); + assertEquals(-4f, ann[0].graphMin, 0.001f); assertEquals(7f, ann[0].graphMax, 0.001f); assertEquals(3, ann[0].annotations.length); assertEquals(1f, ann[0].annotations[0].value, 0.001f); assertEquals(7f, ann[0].annotations[1].value, 0.001f); - assertEquals(4f, ann[0].annotations[2].value, 0.001f); + assertEquals(-4f, ann[0].annotations[2].value, 0.001f); } /** @@ -331,7 +344,7 @@ public class PDBChainTest public void testMakeCaBondList() { c.isNa = true; - Vector atoms = new Vector(); + Vector atoms = new Vector<>(); c.atoms = atoms; atoms.add(makeAtom(4, "N", "MET")); atoms.add(makeAtom(4, "CA", "MET")); @@ -362,7 +375,7 @@ public class PDBChainTest public void testMakeCaBondList_nucleotide() { c.isNa = false; - Vector atoms = new Vector(); + Vector atoms = new Vector<>(); c.atoms = atoms; atoms.add(makeAtom(4, "N", "G")); atoms.add(makeAtom(4, "P", "G")); @@ -393,7 +406,7 @@ public class PDBChainTest @Test(groups = { "Functional" }) public void testMakeExactMapping() { - Vector atoms = new Vector(); + Vector atoms = new Vector<>(); c.atoms = atoms; atoms.add(makeAtom(4, "N", "MET")); atoms.add(makeAtom(4, "CA", "MET"));