X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Ftest%2FTestCase.java;h=5cff3630a725aa1e5fb67301ff1518875589a96c;hp=a62cb0b79646752fb9b37ffca7c4173dc795cac7;hb=620f732927beb44ba33d35cc47646ec53b5f535b;hpb=771c4ba4a1c17a95acbfdcbdb489094b04947713 diff --git a/src/be/nikiroo/utils/test/TestCase.java b/src/be/nikiroo/utils/test/TestCase.java index a62cb0b..5cff363 100644 --- a/src/be/nikiroo/utils/test/TestCase.java +++ b/src/be/nikiroo/utils/test/TestCase.java @@ -1,5 +1,7 @@ package be.nikiroo.utils.test; +import java.util.List; + /** * A {@link TestCase} that can be run with {@link TestLauncher}. * @@ -140,7 +142,7 @@ abstract public class TestCase { } /** - * Check that 2 {@link Object}s are equals. + * Check that 2 longs are equals. * * @param expected * the expected value @@ -155,7 +157,7 @@ abstract public class TestCase { } /** - * Check that 2 {@link Object}s are equals. + * Check that 2 longs are equals. * * @param errorMessage * the error message to display if they differ @@ -173,7 +175,7 @@ abstract public class TestCase { } /** - * Check that 2 {@link Object}s are equals. + * Check that 2 booleans are equals. * * @param expected * the expected value @@ -189,7 +191,7 @@ abstract public class TestCase { } /** - * Check that 2 {@link Object}s are equals. + * Check that 2 booleans are equals. * * @param errorMessage * the error message to display if they differ @@ -208,7 +210,7 @@ abstract public class TestCase { } /** - * Check that 2 {@link Object}s are equals. + * Check that 2 doubles are equals. * * @param expected * the expected value @@ -224,7 +226,7 @@ abstract public class TestCase { } /** - * Check that 2 {@link Object}s are equals. + * Check that 2 doubles are equals. * * @param errorMessage * the error message to display if they differ @@ -242,6 +244,32 @@ abstract public class TestCase { Double.valueOf(actual)); } + /** + * Check that 2 {@link List}s are equals. + * + * @param errorMessage + * the error message to display if they differ + * @param expected + * the expected value + * @param actual + * the actual value + * + * @throws AssertException + * in case they differ + */ + public void assertEquals(List expected, List actual) + throws AssertException { + + assertEquals("The 2 lists don't contain the same number of items", + expected.size(), actual.size()); + + int size = expected.size(); + for (int i = 0; i < size; i++) { + assertEquals("Line " + i + " (0-based) is not correct", + expected.get(i), actual.get(i)); + } + } + /** * Check that given {@link Object} is not NULL. *