X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FStockholmFileTest.java;h=d7a9166a059437aeb4454d1d5a7380b8678f1f07;hb=9ee0ce2ec6284a2d57b422ff7d82f30394fe9d8c;hp=c3fd4e313671a7514ed133040e433b61ab1b300a;hpb=6dd554fdbf34db6b79595d5027159d20225f4894;p=jalview.git diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index c3fd4e3..d7a9166 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -20,9 +20,10 @@ */ package jalview.io; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; +import static org.testng.AssertJUnit.assertTrue; + import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; @@ -34,7 +35,7 @@ import java.util.BitSet; import java.util.HashMap; import java.util.Map; -import org.junit.Test; +import org.testng.annotations.Test; public class StockholmFileTest { @@ -42,24 +43,24 @@ public class StockholmFileTest static String PfamFile = "examples/PF00111_seed.stk", RfamFile = "examples/RF00031_folded.stk"; - @Test + @Test(groups = { "Functional" }) public void pfamFileIO() throws Exception { testFileIOwithFormat(new File(PfamFile), "STH", -1, 0); } - @Test + @Test(groups = { "Functional" }) public void pfamFileDataExtraction() throws Exception { AppletFormatAdapter af = new AppletFormatAdapter(); AlignmentI al = af.readFile(PfamFile, af.FILE, - new IdentifyFile().Identify(PfamFile, af.FILE)); + new IdentifyFile().identify(PfamFile, af.FILE)); int numpdb = 0; for (SequenceI sq : al.getSequences()) { - if (sq.getPDBId() != null) + if (sq.getAllPDBEntries() != null) { - numpdb += sq.getPDBId().size(); + numpdb += sq.getAllPDBEntries().size(); } } assertTrue( @@ -67,7 +68,7 @@ public class StockholmFileTest numpdb > 0); } - @Test + @Test(groups = { "Functional" }) public void rfamFileIO() throws Exception { testFileIOwithFormat(new File(RfamFile), "STH", 2, 1); @@ -83,6 +84,7 @@ public class StockholmFileTest * - label for IO class used to write and read back in the data from * f */ + public static void testFileIOwithFormat(File f, String ioformat, int naliannot, int nminseqann) { @@ -93,7 +95,7 @@ public class StockholmFileTest AppletFormatAdapter rf = new AppletFormatAdapter(); AlignmentI al = rf.readFile(ff, AppletFormatAdapter.FILE, - new IdentifyFile().Identify(ff, AppletFormatAdapter.FILE)); + new IdentifyFile().identify(ff, AppletFormatAdapter.FILE)); assertNotNull("Couldn't read supplied alignment data.", al); @@ -110,7 +112,7 @@ public class StockholmFileTest AppletFormatAdapter.PASTE, ioformat); assertNotNull("Couldn't parse reimported alignment data.", al_input); - String identifyoutput = new IdentifyFile().Identify(outputfile, + String identifyoutput = new IdentifyFile().identify(outputfile, AppletFormatAdapter.PASTE); assertNotNull("Identify routine failed for outputformat " + ioformat, identifyoutput); @@ -134,7 +136,7 @@ public class StockholmFileTest if (naliannot > -1) { assertEquals("Number of alignment annotations", naliannot, - numaliannot); + numaliannot); } assertTrue( @@ -266,7 +268,7 @@ public class StockholmFileTest + (ignoreFeatures ? " ignoring." : ""), ignoreFeatures || (seq_original[i].getSequenceFeatures() == null && seq_new[in] - .getSequenceFeatures() == null) + .getSequenceFeatures() == null) || (seq_original[i].getSequenceFeatures() != null && seq_new[in] .getSequenceFeatures() != null)); // compare sequence features @@ -349,9 +351,11 @@ public class StockholmFileTest an_new.displayCharacter.trim()) || !("" + an_or.secondaryStructure).trim().equals( ("" + an_new.secondaryStructure).trim()) - || (an_or.description != an_new.description && (an_or.description == null - || an_new.description == null || !an_or.description - .equals(an_new.description)))) + || (an_or.description != an_new.description && !((an_or.description == null && an_new.description + .trim().length() == 0) + || (an_new.description == null && an_or.description + .trim().length() == 0) || an_or.description + .trim().equals(an_new.description.trim())))) { System.err.println("Annotation Element Mismatch\nElement " + i + " in original: " + annot_or.annotations[i].toString()