Using asserts

Just to remind ourselves that Assert has tailored methods that are worth using, see

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 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.