Package de.hybris.platform.testframework
Class Assert
java.lang.Object
de.hybris.platform.testframework.Assert
Collection of static assert methods not provided by the JUnit framework. Use it equivalent to the JUnit
Assert class by a static import.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertCollection(String message, Collection expected, Collection actual) Asserts that expected and actual collection contain the same elements and have the same size.static voidassertCollection(Collection expected, Collection actual) Asserts that expected and actual collection contain the same elements and have the same size.static voidassertCollectionElements(Collection actual, Object... objects) Asserts that actual collection contains only given objects.static voidassertEquals(Object expected, Object actual) Extend equality check for objects.static voidassertNotEquals(Object expected, Object actual) Asserts that two objects are not equal.static voidassertNotEquals(String message, Object expected, Object actual) Asserts that two objects are not equal.static <T extends Comparable>
voidassertValueInRange(String message, T lowerLimit, T upperLimit, T actual) Asserts that expected value belongs to a given numerical range .static <T extends Comparable>
voidassertValueInRange(T lowerLimit, T upperLimit, T actual) Asserts that expected value belongs to a given numerical range .static final Listlist()Returns an immutable empty list.static final ListReturns an immutable list containing the given argument.static final ListReturns a list containing the two given arguments.static final ListReturns a list containing the three given arguments.static final ListReturns an immutable list containing the four given arguments.static final Setset()Gets an immutable empty set.static final SetReturns an immutable set containing the given argument.static final Set* Returns an immutable set containing the two given arguments.static final SetReturns an immutable set containing the three given arguments.static final SetReturns an immutable set containing the four given arguments.protected <T> TsingleElement(Collection<T> collection) Gets the single element of the collection, or fail.static final <T> List<T>toList(Collection<T> collection) Converts the given collection to a list.
-
Constructor Details
-
Assert
public Assert()
-
-
Method Details
-
assertCollectionElements
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
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
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 Comparable> void assertValueInRange(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
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
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
Gets an immutable empty set.- Returns:
- an immutable empty set
-
set
Returns an immutable set containing the given argument.- Parameters:
object- element- Returns:
- immutable set containing the given argument
-
set
* Returns an immutable set containing the two given arguments.- Parameters:
object1- first elementobject2- second element- Returns:
- immutable set containing the two given arguments
-
set
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
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
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
Returns an immutable empty list.- Returns:
- immutable empty list
-
list
Returns an immutable list containing the given argument. *- Parameters:
object- element- Returns:
- immutable list containing the given argument
-
list
Returns a list containing the two given arguments. *- Parameters:
object1- first elementobject2- second element- Returns:
- immutable list containing the two given arguments
-
list
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
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
Extend equality check for objects. Tests theObject.equals(Object)method in both directions and compares the result ofObject.hashCode(). -
assertNotEquals
Asserts that two objects are not equal. Throws an AssertionFailedError if they are equal. -
assertNotEquals
Asserts that two objects are not equal. Throws an AssertionFailedError if they are equal.
-