Package org.exoplatform.commons.testing
Class AssertUtils
- java.lang.Object
-
- org.exoplatform.commons.testing.AssertUtils
-
public class AssertUtils extends Object
A collection of assertion helper to make UT easier to read- Author:
- patricelamarque
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertContains(String[] actual, String... expected)Assert a set of expected string items to be all contained in a string arraystatic <T> voidassertContains(Collection<T> actual, T... expected)Assert a set of expected items to be all contained in a collectionstatic voidassertContains(List<String> actual, String... expected)Assert a set of expected string items to be all contained in a collectionstatic voidassertContainsAll(String message, List<String> expected, List<String> actual)All elements of a list should be contained in the expected array of Stringstatic voidassertEmpty(Collection value)Assert a collection is empty (not null)static <T> voidassertEmpty(T[] value)static voidassertEquals(String message, String[] expected, String[] actual)Assertion method on string arraysstatic voidassertException(Class<? extends Exception> exceptionType, Closure code)Assert an exception of a given type is thrown by he code in closurestatic voidassertException(Closure code)static <T> voidassertNotContains(Collection<T> actual, T... expected)Assert a set of expected items NOT to be all contained in a collectionstatic voidassertNotContains(List<String> actual, String... expected)Assert a set of expected string items NOT to be all contained in a collectionstatic <T> voidassertNotEmpty(Collection<T> value)Assert a collection is not empty and not null
-
-
-
Method Detail
-
assertContains
public static <T> void assertContains(Collection<T> actual, T... expected)
Assert a set of expected items to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertNotContains
public static <T> void assertNotContains(Collection<T> actual, T... expected)
Assert a set of expected items NOT to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertContains
public static void assertContains(List<String> actual, String... expected)
Assert a set of expected string items to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertContains
public static void assertContains(String[] actual, String... expected)
Assert a set of expected string items to be all contained in a string array- Parameters:
actual- containmentexpected- items expected to be contained
-
assertNotContains
public static void assertNotContains(List<String> actual, String... expected)
Assert a set of expected string items NOT to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertEmpty
public static void assertEmpty(Collection value)
Assert a collection is empty (not null)- Parameters:
value-
-
assertNotEmpty
public static <T> void assertNotEmpty(Collection<T> value)
Assert a collection is not empty and not null- Type Parameters:
T-- Parameters:
value-
-
assertEmpty
public static <T> void assertEmpty(T[] value)
-
assertContainsAll
public static void assertContainsAll(String message, List<String> expected, List<String> actual)
All elements of a list should be contained in the expected array of String- Parameters:
message-expected-actual-
-
assertEquals
public static void assertEquals(String message, String[] expected, String[] actual)
Assertion method on string arrays- Parameters:
message-expected-actual-
-
assertException
public static void assertException(Closure code)
-
-