Package org.exoplatform.commons.testing
Class AssertUtils
java.lang.Object
org.exoplatform.commons.testing.AssertUtils
A collection of assertion helper to make UT easier to read
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 voidAll 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 Details
-
assertContains
Assert a set of expected items to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertNotContains
Assert a set of expected items NOT to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertContains
Assert a set of expected string items to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertContains
Assert a set of expected string items to be all contained in a string array- Parameters:
actual- containmentexpected- items expected to be contained
-
assertNotContains
Assert a set of expected string items NOT to be all contained in a collection- Parameters:
actual- containmentexpected- items expected to be contained
-
assertEmpty
Assert a collection is empty (not null)- Parameters:
value-
-
assertNotEmpty
Assert a collection is not empty and not null- Type Parameters:
T-- Parameters:
value-
-
assertEmpty
public static <T> void assertEmpty(T[] value) -
assertContainsAll
All elements of a list should be contained in the expected array of String- Parameters:
message-expected-actual-
-
assertEquals
Assertion method on string arrays- Parameters:
message-expected-actual-
-
assertException
-
assertException
Assert an exception of a given type is thrown by he code in closure- Parameters:
exceptionType-code-
-