X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fext%2Fjmol%2FJmolVsJalviewPDBParserEndToEndTest.java;h=0bc41a3c4260eed58ab7ebd90d0a699a6ea29429;hb=4d5f77436c8d77a776ca7c042611f36238c97057;hp=8a89830a6f557bcf4b3ba7c55609fcfda3c0ec7d;hpb=190af5d9e60121fdfba0dee0bcfb1c2fa037d72d;p=jalview.git
diff --git a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java
index 8a89830..0bc41a3 100644
--- a/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java
+++ b/test/jalview/ext/jmol/JmolVsJalviewPDBParserEndToEndTest.java
@@ -1,7 +1,28 @@
+/*
+ * 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 jalview.ext.jmol;
import jalview.datamodel.SequenceI;
-import jalview.io.AppletFormatAdapter;
+import jalview.gui.JvOptionPane;
+import jalview.io.DataSourceType;
import java.io.File;
import java.io.IOException;
@@ -9,7 +30,9 @@ import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
-import MCview.PDBfile;
+import org.testng.annotations.BeforeClass;
+
+import mc_view.PDBfile;
/**
* This is not a unit test, rather it is a bulk End-to-End scan for sequences
@@ -23,12 +46,24 @@ import MCview.PDBfile;
public class JmolVsJalviewPDBParserEndToEndTest
{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
+ /**
+ *
+ * @param args
+ * @j2sIgnore
+ */
public static void main(String[] args)
{
if (args == null || args[0] == null)
{
- System.err
- .println("You must provide a PDB directory in the launch argument");
+ System.err.println(
+ "You must provide a PDB directory in the launch argument");
return;
}
@@ -42,7 +77,7 @@ public class JmolVsJalviewPDBParserEndToEndTest
public static void testFileParser(String testDir, String[] testFiles)
{
- Set failedFiles = new HashSet();
+ Set failedFiles = new HashSet<>();
int totalSeqScanned = 0, totalFail = 0;
for (String pdbStr : testFiles)
{
@@ -52,9 +87,8 @@ public class JmolVsJalviewPDBParserEndToEndTest
try
{
mctest = new PDBfile(false, false, false, testFile,
- AppletFormatAdapter.FILE);
- jtest = new JmolParser(false, false, false, testFile,
- jalview.io.AppletFormatAdapter.FILE);
+ DataSourceType.FILE);
+ jtest = new JmolParser(testFile, DataSourceType.FILE);
} catch (IOException e)
{
System.err.println("Exception thrown while parsing : " + pdbStr);
@@ -66,15 +100,15 @@ public class JmolVsJalviewPDBParserEndToEndTest
{
try
{
- String testSeq = mcseqs.remove(0).getSequenceAsString();
+ String testSeq = mcseqs.remove(0).getSequenceAsString();
if (!sq.getSequenceAsString().equals(testSeq))
- {
- ++totalFail;
+ {
+ ++totalFail;
System.err.println("Test Failed for " + pdbStr + ". Diff:");
- System.err.println(sq.getSequenceAsString());
- System.err.println(testSeq);
- failedFiles.add(pdbStr);
- }
+ System.err.println(sq.getSequenceAsString());
+ System.err.println(testSeq);
+ failedFiles.add(pdbStr);
+ }
++totalSeqScanned;
} catch (Exception e)
{
@@ -85,13 +119,12 @@ public class JmolVsJalviewPDBParserEndToEndTest
int count = 0;
System.out.println("\n\nTotal sequence Scanned : " + totalSeqScanned);
- System.out.println("Total sequence passed : "
- + (totalSeqScanned - totalFail));
+ System.out.println(
+ "Total sequence passed : " + (totalSeqScanned - totalFail));
System.out.println("Total sequence failed : " + totalFail);
- System.out
- .println("Success rate: "
- + ((totalSeqScanned - totalFail) * 100)
- / totalSeqScanned + "%");
+ System.out.println("Success rate: "
+ + ((totalSeqScanned - totalFail) * 100) / totalSeqScanned
+ + "%");
System.out.println("\nList of " + failedFiles.size()
+ " file(s) with sequence diffs:");
for (String problemFile : failedFiles)