X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2FMCview%2FPDBfileTest.java;h=c07c62e0f19550d2ee53ece8870bd9fd9d4ef015;hb=c6018dc0dc12720e13b75850a5303279ac7094b7;hp=31c3beb76d1f990eb1be670b67913ef0aec99f57;hpb=6d7ab37f37b09174ec61fee301aed6057ef86605;p=jalview.git diff --git a/test/MCview/PDBfileTest.java b/test/MCview/PDBfileTest.java index 31c3beb..c07c62e 100644 --- a/test/MCview/PDBfileTest.java +++ b/test/MCview/PDBfileTest.java @@ -26,21 +26,34 @@ import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertSame; import static org.testng.AssertJUnit.assertTrue; +import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; +import jalview.gui.JvOptionPane; +import jalview.io.DataSourceType; +import jalview.structure.StructureImportSettings; import java.io.IOException; import java.util.List; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PDBfileTest { + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + @Test(groups = { "Functional" }) public void testIsRna() { @@ -70,7 +83,7 @@ public class PDBfileTest * Constructor with file path performs parse() */ PDBfile pf = new PDBfile(false, false, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); assertEquals("3W5V", pf.getId()); // verify no alignment annotations created @@ -83,6 +96,8 @@ public class PDBfileTest assertEquals("D", pf.getChains().get(3).id); PDBChain chainA = pf.getChains().get(0); + SequenceI seqA = pf.getSeqs().get(0); + assertEquals(0, chainA.seqstart); // not set assertEquals(0, chainA.seqend); // not set assertEquals(18, chainA.sequence.getStart()); @@ -91,8 +106,8 @@ public class PDBfileTest assertTrue(chainA.sequence.getSequenceAsString().endsWith("WNVEVY")); assertEquals("3W5V|A", chainA.sequence.getName()); assertNull(chainA.sequence.getAnnotation()); - assertEquals(1, chainA.sequence.getAllPDBEntries().size()); - PDBEntry pdb = chainA.sequence.getAllPDBEntries().get(0); + assertEquals(1, seqA.getAllPDBEntries().size()); + PDBEntry pdb = seqA.getAllPDBEntries().get(0); assertEquals("A", pdb.getChainCode()); assertEquals("PDB", pdb.getType()); assertEquals("3W5V", pdb.getId()); @@ -144,7 +159,7 @@ public class PDBfileTest public void testParse_withAnnotations_noSS() throws IOException { PDBfile pf = new PDBfile(true, false, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); AlignmentAnnotation[] anns = getAlignmentAnnotations(pf); assertEquals(4, anns.length); @@ -202,7 +217,7 @@ public class PDBfileTest public void testParse_withJmol_noAnnotations() throws IOException { PDBfile pf = new PDBfile(false, true, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); /* * alignment annotations _are_ created anyway (in @@ -232,7 +247,7 @@ public class PDBfileTest throws IOException { PDBfile pf = new PDBfile(true, true, false, "examples/3W5V.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); /* * Alignment annotations for TempFactor, SecStruct, per sequence (chain) @@ -251,10 +266,10 @@ public class PDBfileTest /* * PDBFileWithJmol (unlike PDBChain!) leaves PDB id upper case */ - assertEquals("Secondary Structure for 3W5VA", anns[0].description); - assertEquals("Secondary Structure for 3W5VB", anns[2].description); - assertEquals("Secondary Structure for 3W5VC", anns[4].description); - assertEquals("Secondary Structure for 3W5VD", anns[6].description); + assertEquals("Secondary Structure for 3w5vA", anns[0].description); + assertEquals("Secondary Structure for 3w5vB", anns[2].description); + assertEquals("Secondary Structure for 3w5vC", anns[4].description); + assertEquals("Secondary Structure for 3w5vD", anns[6].description); /* * Verify SS annotations are linked to respective sequences (chains) @@ -290,7 +305,7 @@ public class PDBfileTest // TODO requires a mock for Annotate3D processing // and/or run as an integration test PDBfile pf = new PDBfile(true, true, true, "examples/2GIS.pdb", - AppletFormatAdapter.FILE); + DataSourceType.FILE); } /** @@ -305,4 +320,17 @@ public class PDBfileTest pf.addAnnotations(al); return al.getAlignmentAnnotation(); } + + @BeforeMethod(alwaysRun = true) + public void setUp() + { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Cache.applicationProperties.setProperty("STRUCT_FROM_PDB", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_TEMPFACT_ANN", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("ADD_SS_ANN", + Boolean.TRUE.toString()); + StructureImportSettings.setDefaultStructureFileFormat("PDB"); + } }