*/
package jalview.analysis;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertFalse;
- import static org.junit.Assert.assertNull;
- import static org.junit.Assert.assertSame;
- import static org.junit.Assert.assertTrue;
++
+ import static org.testng.AssertJUnit.assertEquals;
+ import static org.testng.AssertJUnit.assertFalse;
+ import static org.testng.AssertJUnit.assertNull;
+ import static org.testng.AssertJUnit.assertSame;
+ import static org.testng.AssertJUnit.assertTrue;
+
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import java.util.Map;
import java.util.Set;
- import org.junit.Test;
+ import org.testng.annotations.Test;
- public class AlignmentUtilsTests
+ public class AlignmentUtilsTests
{
// @formatter:off
private static final String TEST_DATA =
*/
protected AlignmentI loadAlignment(final String data, String format) throws IOException
{
- Alignment a = new FormatAdapter().readFile(data,
+ AlignmentI a = new FormatAdapter().readFile(data,
AppletFormatAdapter.PASTE, format);
a.setDataset(null);
return a;
package jalview.datamodel;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertFalse;
- import static org.junit.Assert.assertTrue;
+ import static org.testng.AssertJUnit.assertEquals;
+ import static org.testng.AssertJUnit.assertFalse;
+ import static org.testng.AssertJUnit.assertTrue;
+
import jalview.io.AppletFormatAdapter;
import jalview.io.FormatAdapter;
import jalview.util.MapList;
import java.io.IOException;
import java.util.Iterator;
- import org.junit.Before;
- import org.junit.Test;
+ import org.testng.annotations.BeforeMethod;
+ import org.testng.annotations.Test;
/**
* Unit tests for Alignment datamodel.
protected AlignmentI loadAlignment(final String data, String format)
throws IOException
{
- Alignment a = new FormatAdapter().readFile(data,
+ AlignmentI a = new FormatAdapter().readFile(data,
AppletFormatAdapter.PASTE, format);
a.setDataset(null);
return a;
* Read in Stockholm format test data including secondary structure
* annotations.
*/
- @Before
+ @BeforeMethod
public void setUp() throws IOException
{
al = loadAlignment(TEST_DATA, "STH");
package jalview.io;
- import static org.junit.Assert.assertNotNull;
+ import static org.testng.AssertJUnit.assertNotNull;
+
-import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
import java.util.ArrayList;
import java.util.HashMap;
- import org.junit.After;
- import org.junit.Assert;
- import org.junit.Before;
- import org.junit.Test;
+ import org.testng.AssertJUnit;
+ import org.testng.annotations.AfterMethod;
+ import org.testng.annotations.BeforeMethod;
+ import org.testng.annotations.Test;
public class JSONFileTest
{
HashMap<String, AlignmentAnnotation> testAnnots = new HashMap<String, AlignmentAnnotation>();
HashMap<String, SequenceGroup> testGrps = new HashMap<String, SequenceGroup>();
- @Before
+ @BeforeMethod
public void setup() throws Exception
{
// create and add sequences
TEST_ANOT_HEIGHT = testAnnots.size();
}
- @After
+ @AfterMethod
public void tearDown() throws Exception
{
}
{
String jsonFile = "examples/example.json";
AppletFormatAdapter rf = new AppletFormatAdapter();
- Alignment al = null;
+ AlignmentI al = null;
try
{
al = rf.readFile(jsonFile, AppletFormatAdapter.FILE,
for (SequenceI seq : al.getSequences())
{
SequenceI expectedSeq = testSeqs.get(seq.getName());
- Assert.assertTrue("Failed Sequence Test for >>> " + seq.getName(),
+ AssertJUnit.assertTrue("Failed Sequence Test for >>> " + seq.getName(),
isSeqMatched(expectedSeq, seq));
passedCount++;
}
- Assert.assertEquals("Some Sequences did not pass the test",
+ AssertJUnit.assertEquals("Some Sequences did not pass the test",
TEST_SEQ_HEIGHT, passedCount);
passedCount = 0;
for (SequenceGroup seqGrp : al.getGroups())
{
SequenceGroup expectedGrp = testGrps.get(seqGrp.getName());
- Assert.assertTrue(
+ AssertJUnit.assertTrue(
"Failed SequenceGroup Test for >>> " + seqGrp.getName(),
isGroupMatched(expectedGrp, seqGrp));
passedCount++;
}
- Assert.assertEquals("Some SequenceGroups did not pass the test",
+ AssertJUnit.assertEquals("Some SequenceGroups did not pass the test",
TEST_GRP_HEIGHT, passedCount);
passedCount = 0;
for (AlignmentAnnotation annot : al.getAlignmentAnnotation())
{
AlignmentAnnotation expectedAnnot = testAnnots.get(annot.label);
- Assert.assertTrue("Failed AlignmentAnnotation Test for >>> "
+ AssertJUnit.assertTrue("Failed AlignmentAnnotation Test for >>> "
+ annot.label, isAnnotationMatched(expectedAnnot, annot));
passedCount++;
}
- Assert.assertEquals("Some Sequences did not pass the test",
+ AssertJUnit.assertEquals("Some Sequences did not pass the test",
TEST_ANOT_HEIGHT, passedCount);
// af = new AlignFrame(al, 700, 500);
package jalview.io;
- import static org.junit.Assert.assertNotNull;
- import static org.junit.Assert.assertTrue;
+ import static org.testng.AssertJUnit.assertNotNull;
+ import static org.testng.AssertJUnit.assertTrue;
+
-import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
- import org.junit.Test;
+ import org.testng.annotations.Test;
/**
* Test file for {@link PhylipFile}.
private void testDataExtraction(String file) throws IOException
{
AppletFormatAdapter rf = new AppletFormatAdapter();
- Alignment al = rf.readFile(file, AppletFormatAdapter.FILE,
+ AlignmentI al = rf.readFile(file, AppletFormatAdapter.FILE,
PhylipFile.FILE_DESC);
assertNotNull("Couldn't read supplied alignment data.", al);
public void testIO(String file) throws IOException
{
AppletFormatAdapter rf = new AppletFormatAdapter();
- Alignment al = rf.readFile(file, AppletFormatAdapter.FILE,
+ AlignmentI al = rf.readFile(file, AppletFormatAdapter.FILE,
PhylipFile.FILE_DESC);
assertNotNull("Couldn't read supplied alignment data.", al);
String outputfile = rf.formatSequences(PhylipFile.FILE_DESC, al, true);
- Alignment al_input = new AppletFormatAdapter().readFile(outputfile,
+ AlignmentI al_input = new AppletFormatAdapter().readFile(outputfile,
AppletFormatAdapter.PASTE, PhylipFile.FILE_DESC);
assertNotNull("Couldn't parse reimported alignment data.", al_input);
import java.io.File;
- import org.junit.AfterClass;
- import org.junit.BeforeClass;
- import org.junit.Test;
+ import org.testng.annotations.AfterClass;
+ import org.testng.annotations.BeforeClass;
+ import org.testng.annotations.Test;
public class RNAMLfileTest
{
public void testRnamlToStockholmIO()
{
StockholmFileTest.testFileIOwithFormat(new File(
- "examples/rna-alignment.xml"), "STH", -1, -1);
+ "examples/testdata/rna-alignment.xml"), "STH", -1, -1);
}
*/
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.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
import java.util.HashMap;
import java.util.Map;
- import org.junit.Test;
+ import org.testng.annotations.Test;
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)
{
{
AppletFormatAdapter rf = new AppletFormatAdapter();
- Alignment al = rf.readFile(ff, AppletFormatAdapter.FILE,
+ AlignmentI al = rf.readFile(ff, AppletFormatAdapter.FILE,
new IdentifyFile().Identify(ff, AppletFormatAdapter.FILE));
assertNotNull("Couldn't read supplied alignment data.", al);
System.out.println("Output file in '" + ioformat + "':\n"
+ outputfile + "\n<<EOF\n");
// test for consistency in io
- Alignment al_input = new AppletFormatAdapter().readFile(outputfile,
+ AlignmentI al_input = new AppletFormatAdapter().readFile(outputfile,
AppletFormatAdapter.PASTE, ioformat);
assertNotNull("Couldn't parse reimported alignment data.", al_input);
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()
package jalview.util;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertSame;
- import static org.junit.Assert.assertTrue;
++
+ import static org.testng.AssertJUnit.assertEquals;
+ import static org.testng.AssertJUnit.assertSame;
+ import static org.testng.AssertJUnit.assertTrue;
+
import jalview.api.AlignViewportI;
import jalview.datamodel.AlignedCodonFrame;
-import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SearchResults;
import java.util.List;
import java.util.Set;
- import org.junit.Test;
+ import org.testng.annotations.Test;
public class MappingUtilsTest
{
protected AlignmentI loadAlignment(final String data, String format)
throws IOException
{
- Alignment a = new FormatAdapter().readFile(data,
+ AlignmentI a = new FormatAdapter().readFile(data,
AppletFormatAdapter.PASTE, format);
a.setDataset(null);
return a;