X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FAnnotatedPDBFileInputTest.java;h=d8ae9990ea1cced726bd17068a3e4faa9dadb421;hb=483e7163b1fb8d4bcb9393014816c944befce328;hp=c47257632828129bc59adb52ba1cfabe126e093f;hpb=b95aa2c5c4b78241d21aafc18ef806b8171c36d1;p=jalview.git diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index c472576..d8ae999 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -31,6 +31,9 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.JvOptionPane; +import jalview.structure.StructureImportSettings; +import jalview.structure.StructureImportSettings.StructureParser; import java.io.File; @@ -42,6 +45,13 @@ import org.testng.annotations.Test; public class AnnotatedPDBFileInputTest { + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + AlignmentI al; String pdbId; @@ -61,10 +71,13 @@ public class AnnotatedPDBFileInputTest Boolean.TRUE.toString()); FileLoader loader = new FileLoader(false); AlignFrame af = loader.LoadFileWaitTillLoaded("examples/1gaq.txt", - FormatAdapter.FILE); + DataSourceType.FILE); al = af.getViewport().getAlignment(); pdbId = al.getSequenceAt(0).getDatasetSequence().getAllPDBEntries() .get(0).getId(); + StructureImportSettings.setDefaultStructureFileFormat("PDB"); + // StructureImportSettings + // .setDefaultPDBFileParser(StructureParser.JALVIEW_PARSER); } @Test(groups = { "Functional" }) @@ -80,8 +93,8 @@ public class AnnotatedPDBFileInputTest { for (int q = p + 1; q < avec.length; q++) { - assertTrue("Found a duplicate annotation row " - + avec[p].label, avec[p] != avec[q]); + assertTrue("Found a duplicate annotation row " + avec[p].label, + avec[p] != avec[q]); } } } @@ -96,7 +109,11 @@ public class AnnotatedPDBFileInputTest { System.out.println("CalcId: " + aa.getCalcId()); - assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId)); + if (StructureImportSettings.getDefaultPDBFileParser().equals( + StructureParser.JALVIEW_PARSER)) + { + assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId)); + } } } } @@ -180,7 +197,7 @@ public class AnnotatedPDBFileInputTest /** * @throws java.lang.Exception */ - @AfterClass + @AfterClass(alwaysRun = true) public static void tearDownAfterClass() throws Exception { jalview.gui.Desktop.instance.closeAll_actionPerformed(null); @@ -195,14 +212,14 @@ public class AnnotatedPDBFileInputTest String tfile = File.createTempFile("JalviewTest", ".jvp") .getAbsolutePath(); AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( - inFile, FormatAdapter.FILE); + inFile, DataSourceType.FILE); assertTrue("Didn't read input file " + inFile, af != null); assertTrue("Failed to store as a project.", - af.saveAlignment(tfile, "Jalview")); + af.saveAlignment(tfile, FileFormat.Jalview)); af.closeMenuItem_actionPerformed(true); af = null; af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, - FormatAdapter.FILE); + DataSourceType.FILE); assertTrue("Failed to import new project", af != null); for (SequenceI asq : af.getViewport().getAlignment().getSequences()) { @@ -212,8 +229,8 @@ public class AnnotatedPDBFileInputTest sq = sq.getDatasetSequence(); } assertNotNull(sq.getAllPDBEntries()); - assertEquals("Expected only one PDB ID", - sq.getAllPDBEntries().size(), 1); + assertEquals("Expected only one PDB ID", 1, sq.getAllPDBEntries() + .size()); for (PDBEntry pdbentry : sq.getAllPDBEntries()) { System.err.println("PDB Entry " + pdbentry.getId() + " "