public class Assert
extends java.lang.Object
Assert.assertEquals(...)
, however, readability can be improved if they
are referenced through static import:import static com.jalios.jcms.test.Assert.*; ... assertEquals(...);
Modifier | Constructor and Description |
---|---|
protected |
Assert()
Protect constructor since it is a static only class
|
Modifier and Type | Method and Description |
---|---|
static void |
assertAlert(Alert expectedAlert,
Alert actualAlert) |
static void |
assertCanBeReadBy(Publication pub,
Group grp) |
static void |
assertCanBeReadBy(Publication pub,
Member mbr) |
static void |
assertCanBeReadBy(Publication pub,
Member mbr,
boolean searchInGroup) |
static void |
assertCanDeleteOther(Member mbr,
Data data) |
static void |
assertCannotBeReadBy(Publication pub,
Group grp,
RightInfo.Explanation restriction) |
static void |
assertCannotBeReadBy(Publication pub,
Member mbr,
boolean searchInGroup,
RightInfo.Explanation explanation) |
static void |
assertCannotBeReadBy(Publication pub,
Member mbr,
RightInfo.Explanation explanation) |
static void |
assertCannotDeleteOther(Member mbr,
Data data,
RightInfo.Explanation explanation) |
static void |
assertCannotUpdateOther(Member mbr,
Data data,
RightInfo.Explanation explanation) |
static void |
assertCannotWorkOn(Member mbr,
Publication pub,
RightInfo.Explanation explanation) |
static void |
assertCanUpdateOther(Member mbr,
Data data) |
static void |
assertCanWorkOn(Member mbr,
Publication pub) |
static <T> void |
assertCmpEquals(java.util.Comparator<T> comparator,
T o1,
T o2) |
static <T> void |
assertCmpGreater(java.util.Comparator<T> comparator,
T o1,
T o2) |
static <T> void |
assertCmpLower(java.util.Comparator<T> comparator,
T o1,
T o2) |
static <T> void |
assertCmpOpposite(java.util.Comparator<T> comparator,
T o1,
T o2) |
static <T> void |
assertCmpSame(java.util.Comparator<T> c1,
java.util.Comparator<T> c2,
T o1,
T o2) |
static void |
assertContainsAll(java.util.Collection<?> expectedElements,
java.util.Collection<?> actualElements) |
static void |
assertContainsAll(java.lang.String message,
java.util.Collection<?> expectedElements,
java.util.Collection<?> actualElements)
Assert that all elements in expectedElements are contained in actualElements, but actualElements can contain others elements not in expectedElements.
|
static void |
assertDateRange(java.util.Date date,
java.util.Date lowerDate,
java.util.Date upperDate)
Assert the given date d1 is in range {d2, d3}
|
static void |
assertDateRangeStrict(java.util.Date date,
java.util.Date lowerDate,
java.util.Date upperDate)
Assert the given date date is in the range {lowerDate, upperDate}
|
static void |
assertIsEmpty(java.lang.Object obj) |
static void |
assertIsEmpty(java.lang.String message,
java.lang.Object obj) |
static void |
assertNotEmpty(java.lang.Object obj) |
static void |
assertNotEmpty(java.lang.String message,
java.lang.Object obj) |
static void |
assertNotSameContent(java.util.Date date1,
java.util.Date date2) |
static void |
assertNotSameContent(java.util.List<?> list1,
java.util.List<?> list2) |
static void |
assertNotSameContent(java.util.Map<?,?> map1,
java.util.Map<?,?> map2) |
static void |
assertNotSameContent(java.lang.Object[] array1,
java.lang.Object[] array2) |
static void |
assertNotSameContent(java.util.Set<?> set1,
java.util.Set<?> set2) |
static void |
assertNotSameContent(java.lang.String message,
java.util.Collection<?> col1,
java.util.Collection<?> col2) |
static void |
assertNotSameContent(java.lang.String message,
java.util.Date date1,
java.util.Date date2) |
static void |
assertNotSameContent(java.lang.String message,
java.util.List<?> list1,
java.util.List<?> list2) |
static void |
assertNotSameContent(java.lang.String message,
java.util.Map<?,?> map1,
java.util.Map<?,?> map2) |
static void |
assertNotSameContent(java.lang.String message,
java.lang.Object[] array1,
java.lang.Object[] array2) |
static void |
assertNotSameContent(java.lang.String message,
java.util.Set<?> set1,
java.util.Set<?> set2) |
static void |
assertObjectIsGarbageCollected(java.lang.ref.WeakReference<? extends java.lang.Object> wRef,
long timeout,
boolean heapDump)
Check that the specified Object (referenced through a WeakReference) is garbage collected
in the designated time.
|
static void |
assertRange(long value,
long minValue,
long maxValue,
boolean strict)
Assert the given value lesser than minValue and graeter than maxValue.
|
static void |
assertSameContent(java.util.Collection<?> set1,
java.util.Collection<?> set2) |
static void |
assertSameContent(java.util.Date date1,
java.util.Date date2) |
static void |
assertSameContent(java.util.List<?> list1,
java.util.List<?> list2) |
static void |
assertSameContent(java.util.Map<?,?> map1,
java.util.Map<?,?> map2) |
static void |
assertSameContent(java.lang.Object[] array1,
java.lang.Object[] array2) |
static void |
assertSameContent(java.util.Set<?> set1,
java.util.Set<?> set2) |
static void |
assertSameContent(java.lang.String message,
java.util.Collection<?> col1,
java.util.Collection<?> col2) |
static void |
assertSameContent(java.lang.String message,
java.util.Date date1,
java.util.Date date2) |
static void |
assertSameContent(java.lang.String message,
java.util.List<?> list1,
java.util.List<?> list2) |
static void |
assertSameContent(java.lang.String message,
java.util.Map<?,?> map1,
java.util.Map<?,?> map2) |
static void |
assertSameContent(java.lang.String message,
java.lang.Object[] array1,
java.lang.Object[] array2) |
static void |
assertSameHtml(java.lang.String htmlFragment1,
java.lang.String htmlFragment2)
Asserts that the two specified HTML fragment are the same.
|
static void |
assertSameHtml(java.lang.String message,
java.lang.String htmlFragment1,
java.lang.String htmlFragment2)
Asserts that the two specified HTML fragment are the same.
|
static void |
assertStatusForbidden(ControllerStatus status) |
static void |
assertStatusHasFailed(ControllerStatus status) |
static void |
assertStatusHasFailed(java.lang.String prop,
ControllerStatus status) |
static void |
assertStatusHasFailed(java.lang.String msg,
java.lang.String prop,
ControllerStatus status) |
static void |
assertStatusOK(ControllerStatus status) |
static void |
assertStatusOK(java.lang.String msg,
ControllerStatus status) |
static void |
assertTypesDisabled(Workspace ws,
java.lang.Class<?>... classes)
Assert given types are disabled in the given Workspace.
|
static void |
assertTypesEnabled(Workspace ws,
java.lang.Class<?>... classes)
Assert given types are enabled in the given Workspace.
|
public static void assertStatusOK(ControllerStatus status)
public static void assertStatusOK(java.lang.String msg, ControllerStatus status)
public static void assertStatusForbidden(ControllerStatus status)
public static void assertStatusHasFailed(ControllerStatus status)
public static void assertStatusHasFailed(java.lang.String prop, ControllerStatus status)
public static void assertStatusHasFailed(java.lang.String msg, java.lang.String prop, ControllerStatus status)
public static void assertCanBeReadBy(Publication pub, Member mbr)
public static void assertCannotBeReadBy(Publication pub, Member mbr, RightInfo.Explanation explanation)
public static void assertCanBeReadBy(Publication pub, Member mbr, boolean searchInGroup)
public static void assertCannotBeReadBy(Publication pub, Member mbr, boolean searchInGroup, RightInfo.Explanation explanation)
public static void assertCanBeReadBy(Publication pub, Group grp)
public static void assertCannotBeReadBy(Publication pub, Group grp, RightInfo.Explanation restriction)
public static void assertCannotUpdateOther(Member mbr, Data data, RightInfo.Explanation explanation)
public static void assertCannotDeleteOther(Member mbr, Data data, RightInfo.Explanation explanation)
public static void assertCanWorkOn(Member mbr, Publication pub)
public static void assertCannotWorkOn(Member mbr, Publication pub, RightInfo.Explanation explanation)
public static <T> void assertCmpGreater(java.util.Comparator<T> comparator, T o1, T o2)
public static <T> void assertCmpLower(java.util.Comparator<T> comparator, T o1, T o2)
public static <T> void assertCmpEquals(java.util.Comparator<T> comparator, T o1, T o2)
public static <T> void assertCmpOpposite(java.util.Comparator<T> comparator, T o1, T o2)
public static <T> void assertCmpSame(java.util.Comparator<T> c1, java.util.Comparator<T> c2, T o1, T o2)
public static void assertSameContent(java.lang.Object[] array1, java.lang.Object[] array2)
public static void assertSameContent(java.lang.String message, java.lang.Object[] array1, java.lang.Object[] array2)
public static void assertNotSameContent(java.lang.Object[] array1, java.lang.Object[] array2)
public static void assertNotSameContent(java.lang.String message, java.lang.Object[] array1, java.lang.Object[] array2)
public static void assertSameHtml(java.lang.String htmlFragment1, java.lang.String htmlFragment2)
htmlFragment1
- the first HTML fragment to comparehtmlFragment2
- the second HTML fragment to comparepublic static void assertSameHtml(java.lang.String message, java.lang.String htmlFragment1, java.lang.String htmlFragment2)
message
- a message displayed when assertion failshtmlFragment1
- the first HTML fragment to comparehtmlFragment2
- the second HTML fragment to comparepublic static void assertSameContent(java.util.Collection<?> set1, java.util.Collection<?> set2)
public static void assertSameContent(java.lang.String message, java.util.Collection<?> col1, java.util.Collection<?> col2)
public static void assertNotSameContent(java.lang.String message, java.util.Collection<?> col1, java.util.Collection<?> col2)
public static void assertSameContent(java.util.Set<?> set1, java.util.Set<?> set2)
public static void assertNotSameContent(java.util.Set<?> set1, java.util.Set<?> set2)
public static void assertNotSameContent(java.lang.String message, java.util.Set<?> set1, java.util.Set<?> set2)
public static void assertContainsAll(java.util.Collection<?> expectedElements, java.util.Collection<?> actualElements)
expectedElements
- all elements must be contained by actualElementsactualElements
- the collection to assert it contains all elements in expectedElementsassertContainsAll(String, Collection, Collection)
public static void assertContainsAll(java.lang.String message, java.util.Collection<?> expectedElements, java.util.Collection<?> actualElements)
message
- optional messageexpectedElements
- all elements must be contained by actualElementsactualElements
- the collection to assert it contains all elements in expectedElementspublic static void assertSameContent(java.util.List<?> list1, java.util.List<?> list2)
public static void assertSameContent(java.lang.String message, java.util.List<?> list1, java.util.List<?> list2)
public static void assertNotSameContent(java.util.List<?> list1, java.util.List<?> list2)
public static void assertNotSameContent(java.lang.String message, java.util.List<?> list1, java.util.List<?> list2)
public static void assertSameContent(java.util.Map<?,?> map1, java.util.Map<?,?> map2)
public static void assertSameContent(java.lang.String message, java.util.Map<?,?> map1, java.util.Map<?,?> map2)
public static void assertNotSameContent(java.util.Map<?,?> map1, java.util.Map<?,?> map2)
public static void assertNotSameContent(java.lang.String message, java.util.Map<?,?> map1, java.util.Map<?,?> map2)
public static void assertSameContent(java.util.Date date1, java.util.Date date2)
public static void assertSameContent(java.lang.String message, java.util.Date date1, java.util.Date date2)
public static void assertNotSameContent(java.util.Date date1, java.util.Date date2)
public static void assertNotSameContent(java.lang.String message, java.util.Date date1, java.util.Date date2)
public static void assertIsEmpty(java.lang.Object obj)
public static void assertIsEmpty(java.lang.String message, java.lang.Object obj)
public static void assertNotEmpty(java.lang.Object obj)
public static void assertNotEmpty(java.lang.String message, java.lang.Object obj)
public static void assertRange(long value, long minValue, long maxValue, boolean strict)
value
- the valueminValue
- the minValuemaxValue
- the maxValuestrict
- true if the comparison must be strictpublic static void assertDateRange(java.util.Date date, java.util.Date lowerDate, java.util.Date upperDate)
date
- the date to be testedlowerDate
- the lower date limit (may be null)upperDate
- the upper date limit (may be null)public static void assertDateRangeStrict(java.util.Date date, java.util.Date lowerDate, java.util.Date upperDate)
date
- the date to be testedlowerDate
- the lower date limit (may be null)upperDate
- the upper date limit (may be null)public static void assertObjectIsGarbageCollected(java.lang.ref.WeakReference<? extends java.lang.Object> wRef, long timeout, boolean heapDump)
IMPORTANT : in order for this method to work properly and success, you must get rid of all strong references of your object in the method callee. For example :
Publication pub1 = createSmallNews(admin, defaultWorkspace); pub1.performDelete(); // 1. Create WeakReference for the object WeakReference<Object> pub1WeakRef = new WeakReference<Object>(pub1); // 2. Remove strong reference for the object pub1 = null; // 3. Test object is garbage collected correctly, requesting a heap dump in case of failure assertObjectIsGarbageCollected(pub1WeakRef, 10*MILLIS_IN_ONE_SECOND, true);
Implementation note : this method will trigger a GC through System.gc()
every second until the timeout has been reached or the object is detected has garbage collected.
wRef
- the object WeakReference (required to prevent strong reference of object through callstack)timeout
- the timeout after which this method will consider (should be a multiple of 1000 ms with current implementation)heapDump
- perform HEAP dump on failure for easier debuggingpublic static void assertTypesEnabled(Workspace ws, java.lang.Class<?>... classes)
ws
- the workspace to testclasses
- classes to test they are enabled in wspublic static void assertTypesDisabled(Workspace ws, java.lang.Class<?>... classes)
ws
- the workspace to testclasses
- classes to test they are disabled in wsCopyright © 2001-2017 Jalios SA. All Rights Reserved.