public class Assert extends Object
org.junit.Assert class by a static import.| Constructor and Description |
|---|
Assert() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertCollection(Collection expected,
Collection actual)
Asserts that expected and actual collection contain the same elements and have the same size.
|
static void |
assertCollection(String message,
Collection expected,
Collection actual)
Asserts that expected and actual collection contain the same elements and have the same size.
|
static void |
assertCollectionElements(Collection actual,
Object... objects)
Asserts that actual collection contains only given objects.
|
static void |
assertCollectionElements(Object obj,
Collection actual)
Deprecated.
|
static void |
assertCollectionElements(Object objA,
Object objB,
Collection actual)
Deprecated.
|
static void |
assertCollectionElements(Object objA,
Object objB,
Object objC,
Collection actual)
Deprecated.
|
static void |
assertCollectionElements(Object objA,
Object objB,
Object objC,
Object objD,
Collection actual)
Deprecated.
|
static void |
assertNotEquals(Object expected,
Object actual)
Asserts that two objects are not equal.
|
static void |
assertNotEquals(String message,
Object expected,
Object actual)
Asserts that two objects are not equal.
|
static <T extends Comparable> |
assertValueInRange(String message,
T lowerLimit,
T upperLimit,
T actual)
Asserts that expected value belongs to a given numerical range .
|
static <T extends Comparable> |
assertValueInRange(T lowerLimit,
T upperLimit,
T actual)
Asserts that expected value belongs to a given numerical range .
|
static List |
list()
Returns an immutable empty list.
|
static List |
list(Object object)
Returns an immutable list containing the given argument.
|
static List |
list(Object object1,
Object object2)
Returns a list containing the two given arguments.
|
static List |
list(Object object1,
Object object2,
Object object3)
Returns a list containing the three given arguments.
|
static List |
list(Object object1,
Object object2,
Object object3,
Object object4)
Returns an immutable list containing the four given arguments.
|
static <T> List<T> |
reverse(List<T> source)
Deprecated.
|
static Set |
set()
Gets an immutable empty set.
|
static Set |
set(Object object)
Returns an immutable set containing the given argument.
|
static Set |
set(Object object1,
Object object2)
* Returns an immutable set containing the two given arguments.
|
static Set |
set(Object object1,
Object object2,
Object object3)
Returns an immutable set containing the three given arguments.
|
static Set |
set(Object object1,
Object object2,
Object object3,
Object object4)
Returns an immutable set containing the four given arguments.
|
protected <T> T |
singleElement(Collection<T> collection)
Gets the single element of the collection, or fail.
|
static <T> List<T> |
toList(Collection<T> collection)
Converts the given collection to a list.
|
public static void assertCollectionElements(Collection actual, Object... objects)
actual - collection which has to contain only given objectsobjects - objects that has to be existent in given collection and no other one@Deprecated public static void assertCollectionElements(Object obj, Collection actual)
assertCollectionElements(Collection, Object...)@Deprecated public static void assertCollectionElements(Object objA, Object objB, Collection actual)
assertCollectionElements(Collection, Object...)@Deprecated public static void assertCollectionElements(Object objA, Object objB, Object objC, Collection actual)
assertCollectionElements(Collection, Object...)@Deprecated public static void assertCollectionElements(Object objA, Object objB, Object objC, Object objD, Collection actual)
assertCollectionElements(Collection, Object...)public static void assertCollection(Collection expected, Collection actual)
expected - collection used as reference collection for the actual oneactual - collection which has to have exactly the same elements as the expected onepublic static <T extends Comparable> void assertValueInRange(T lowerLimit, T upperLimit, T actual)
lowerLimit - lower limit of the expected rangeupperLimit - upper limit of the expected rangeactual - actual valuepublic static <T extends Comparable> void assertValueInRange(String message, T lowerLimit, T upperLimit, T actual)
message - Failure messagelowerLimit - lower limit of the expected rangeupperLimit - upper limit of the expected rangeactual - actual valuepublic static void assertCollection(String message, Collection expected, Collection actual)
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 firesprotected <T> T singleElement(Collection<T> collection)
T - type of the elementcollection - collection from which the single element is neededpublic static final Set set()
public static final Set set(Object object)
object - elementpublic static final Set set(Object object1, Object object2)
object1 - first elementobject2 - second elementpublic static final Set set(Object object1, Object object2, Object object3)
object1 - first elementobject2 - second elementobject3 - third elementpublic static final Set set(Object object1, Object object2, Object object3, Object object4)
object1 - first elementobject2 - second elementobject3 - third elementobject4 - fourth elementpublic static final <T> List<T> toList(Collection<T> collection)
T - type of collection elementscollection - collection to convert@Deprecated public static final <T> List<T> reverse(List<T> source)
Collections.reverse(List)T - type of list elementssource - list to reversepublic static final List list()
public static final List list(Object object)
object - elementpublic static final List list(Object object1, Object object2)
object1 - first elementobject2 - second elementpublic static final List list(Object object1, Object object2, Object object3)
object1 - first elementobject2 - second elementobject3 - third elementpublic static final List list(Object object1, Object object2, Object object3, Object object4)
object1 - first elementobject2 - second elementobject3 - third elementobject4 - fourth elementpublic static void assertNotEquals(Object expected, Object actual)
Copyright © 2017 SAP SE. All Rights Reserved.