Just to remind ourselves that Assert has tailored methods that are worth using, see
http://www.exubero.com/junit/antipatterns.html#Using_the_Wrong_Assert
http://testng.org/javadocs/org/testng/Assert.html
http://testng.org/javadocs/org/testng/AssertJUnit.html
That way you keep the test concise, get the most specific error message on failure, assertEquals() handles null values for you, and anyone reading the test is clear as to its intention.
Note that org.testng.AssertJUnit has the JUnit assertArrayEquals() methods, but org.testng.Assert overloads assertEquals() with arguments for Object array, also for Collection, Set and Iterator.
So for example
org.testng.Assert.assertEquals(expected.getSequences(), alignment.getSequences())
will report the position of the first mismatching sequence.
- much neater than writing out the loop for yourself
Mungo
Mungo Carstairs
The University of Dundee is a registered Scottish Charity, No: SC015096
ยทยทยท
Jalview Computational Scientist
The Barton Group
Division of Computational Biology
School of Life Sciences
University of Dundee, Dundee, Scotland, UK.
www.jalview.org
www.compbio.dundee.ac.uk