|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.emarsys.ecommon.test.testng.TestAsserts
public class TestAsserts
Helper class for custom asserts in unit test cases. TODO not fully tested
Constructor Summary | |
---|---|
TestAsserts()
|
Method Summary | ||
---|---|---|
static
|
equals(C actual,
C expected)
Checks whether the passed Collections contain the same elements or throws an AssertionError
and prints more verbose logging messages than
Assert if not. |
|
static void |
equals(int[] actual,
int[] expected)
Checks whether the passed integer arrays contain the same elements or throws an AssertionError . |
|
static
|
equals(java.util.Map<K,V> actual,
java.util.Map<K,V> expected)
Checks whether the passed Map s contain the same
key-value-pairs and throws an AssertionError
and prints more verbose logging messages than
Assert if not. |
|
static void |
expectExceptions(RunnableTest test,
java.lang.Class<?>... expectedExceptions)
Runs the passed test and expects it to throw an Exception whose Class is one of the
passed expected exception classes. |
|
protected static boolean |
isExceptionExpected(java.lang.Exception ex,
java.lang.Class<?>... expectedExceptions)
|
|
static void |
isPercentage(double p)
|
|
static void |
isPercentage(int p)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TestAsserts()
Method Detail |
---|
public static void equals(int[] actual, int[] expected)
AssertionError
.
T
- C
- actual
- expected
- public static <T,C extends java.util.Collection<T>> void equals(C actual, C expected)
AssertionError
and prints more verbose logging messages than
Assert
if not.
T
- C
- actual
- expected
- public static <K,V> void equals(java.util.Map<K,V> actual, java.util.Map<K,V> expected)
Map
s contain the same
key-value-pairs and throws an AssertionError
and prints more verbose logging messages than
Assert
if not.
K
- V
- actual
- expected
- public static void expectExceptions(RunnableTest test, java.lang.Class<?>... expectedExceptions)
Runs the passed test and expects it to throw an
Exception
whose Class
is one of the
passed expected exception classes.
The method is intended to mimic the behavior of an ordinary
TestNG Test
method with
'expectedExceptions' specified but aims at providing a more
dynamic and flexible approach.
If no Exception
or an unspecified/unexpected is thrown
during the RunnableTest
then an AssertionError
will be raised.
test
- - the test case encapsulated in a runnableexpectedExceptions
- protected static boolean isExceptionExpected(java.lang.Exception ex, java.lang.Class<?>... expectedExceptions)
public static void isPercentage(double p)
p
- public static void isPercentage(int p)
p
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |