Package de.hybris.platform.testframework
Class Assert
- java.lang.Object
-
- de.hybris.platform.testframework.Assert
-
public class Assert extends java.lang.ObjectCollection of static assert methods not provided by the JUnit framework. Use it equivalent to the JUnitAssertclass by a static import.
-
-
Constructor Summary
Constructors Constructor Description Assert()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidassertCollection(java.lang.String message, java.util.Collection expected, java.util.Collection actual)Asserts that expected and actual collection contain the same elements and have the same size.static voidassertCollection(java.util.Collection expected, java.util.Collection actual)Asserts that expected and actual collection contain the same elements and have the same size.static voidassertCollectionElements(java.util.Collection actual, java.lang.Object... objects)Asserts that actual collection contains only given objects.static voidassertEquals(java.lang.Object expected, java.lang.Object actual)Extend equality check for objects.static voidassertNotEquals(java.lang.Object expected, java.lang.Object actual)Asserts that two objects are not equal.static voidassertNotEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)Asserts that two objects are not equal.static <T extends java.lang.Comparable>
voidassertValueInRange(java.lang.String message, T lowerLimit, T upperLimit, T actual)Asserts that expected value belongs to a given numerical range .static <T extends java.lang.Comparable>
voidassertValueInRange(T lowerLimit, T upperLimit, T actual)Asserts that expected value belongs to a given numerical range .static java.util.Listlist()Returns an immutable empty list.static java.util.Listlist(java.lang.Object object)Returns an immutable list containing the given argument.static java.util.Listlist(java.lang.Object object1, java.lang.Object object2)Returns a list containing the two given arguments.static java.util.Listlist(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3)Returns a list containing the three given arguments.static java.util.Listlist(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3, java.lang.Object object4)Returns an immutable list containing the four given arguments.static java.util.Setset()Gets an immutable empty set.static java.util.Setset(java.lang.Object object)Returns an immutable set containing the given argument.static java.util.Setset(java.lang.Object object1, java.lang.Object object2)* Returns an immutable set containing the two given arguments.static java.util.Setset(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3)Returns an immutable set containing the three given arguments.static java.util.Setset(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3, java.lang.Object object4)Returns an immutable set containing the four given arguments.protected <T> TsingleElement(java.util.Collection<T> collection)Gets the single element of the collection, or fail.static <T> java.util.List<T>toList(java.util.Collection<T> collection)Converts the given collection to a list.
-
-
-
Method Detail
-
assertCollectionElements
public static void assertCollectionElements(java.util.Collection actual, java.lang.Object... objects)Asserts that actual collection contains only given objects.- Parameters:
actual- collection which has to contain only given objectsobjects- objects that has to be existent in given collection and no other one
-
assertCollection
public static void assertCollection(java.util.Collection expected, java.util.Collection actual)Asserts that expected and actual collection contain the same elements and have the same size.- Parameters:
expected- collection used as reference collection for the actual oneactual- collection which has to have exactly the same elements as the expected one
-
assertValueInRange
public static <T extends java.lang.Comparable> void assertValueInRange(T lowerLimit, T upperLimit, T actual)Asserts that expected value belongs to a given numerical range .- Parameters:
lowerLimit- lower limit of the expected rangeupperLimit- upper limit of the expected rangeactual- actual value
-
assertValueInRange
public static <T extends java.lang.Comparable> void assertValueInRange(java.lang.String message, T lowerLimit, T upperLimit, T actual)Asserts that expected value belongs to a given numerical range .- Parameters:
message- Failure messagelowerLimit- lower limit of the expected rangeupperLimit- upper limit of the expected rangeactual- actual value
-
assertCollection
public static void assertCollection(java.lang.String message, java.util.Collection expected, java.util.Collection actual)Asserts that expected and actual collection contain the same elements and have the same size.- Parameters:
expected- collection used as reference collection for the actual oneactual- collection which has to have exactly the same elements as the expected onemessage- to show if assertion fires
-
singleElement
protected <T> T singleElement(java.util.Collection<T> collection)
Gets the single element of the collection, or fail.- Type Parameters:
T- type of the element- Parameters:
collection- collection from which the single element is needed- Returns:
- the single element contained in given collection
-
set
public static final java.util.Set set()
Gets an immutable empty set.- Returns:
- an immutable empty set
-
set
public static final java.util.Set set(java.lang.Object object)
Returns an immutable set containing the given argument.- Parameters:
object- element- Returns:
- immutable set containing the given argument
-
set
public static final java.util.Set set(java.lang.Object object1, java.lang.Object object2)* Returns an immutable set containing the two given arguments.- Parameters:
object1- first elementobject2- second element- Returns:
- immutable set containing the two given arguments
-
set
public static final java.util.Set set(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3)Returns an immutable set containing the three given arguments.- Parameters:
object1- first elementobject2- second elementobject3- third element- Returns:
- immutable set containing the three given arguments
-
set
public static final java.util.Set set(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3, java.lang.Object object4)Returns an immutable set containing the four given arguments.- Parameters:
object1- first elementobject2- second elementobject3- third elementobject4- fourth element- Returns:
- immutable set containing the four given arguments
-
toList
public static final <T> java.util.List<T> toList(java.util.Collection<T> collection)
Converts the given collection to a list.- Type Parameters:
T- type of collection elements- Parameters:
collection- collection to convert- Returns:
- list of elements of given collection
-
list
public static final java.util.List list()
Returns an immutable empty list.- Returns:
- immutable empty list
-
list
public static final java.util.List list(java.lang.Object object)
Returns an immutable list containing the given argument. *- Parameters:
object- element- Returns:
- immutable list containing the given argument
-
list
public static final java.util.List list(java.lang.Object object1, java.lang.Object object2)Returns a list containing the two given arguments. *- Parameters:
object1- first elementobject2- second element- Returns:
- immutable list containing the two given arguments
-
list
public static final java.util.List list(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3)Returns a list containing the three given arguments.- Parameters:
object1- first elementobject2- second elementobject3- third element- Returns:
- immutable list containing the three given arguments
-
list
public static final java.util.List list(java.lang.Object object1, java.lang.Object object2, java.lang.Object object3, java.lang.Object object4)Returns an immutable list containing the four given arguments.- Parameters:
object1- first elementobject2- second elementobject3- third elementobject4- fourth element- Returns:
- immutable list containing the four given arguments
-
assertEquals
public static void assertEquals(java.lang.Object expected, java.lang.Object actual)Extend equality check for objects. Tests theObject.equals(Object)method in both directions and compares the result ofObject.hashCode().
-
assertNotEquals
public static void assertNotEquals(java.lang.Object expected, java.lang.Object actual)Asserts that two objects are not equal. Throws an AssertionFailedError if they are equal.
-
assertNotEquals
public static void assertNotEquals(java.lang.String message, java.lang.Object expected, java.lang.Object actual)Asserts that two objects are not equal. Throws an AssertionFailedError if they are equal.
-
-