public class Assert
extends java.lang.Object
org.junit.Assert class by a static import.| Constructor and Description |
|---|
Assert() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
static void |
assertCollectionElements(java.util.Collection actual,
java.lang.Object... objects)
Asserts that actual collection contains only given objects.
|
static void |
assertEquals(java.lang.Object expected,
java.lang.Object actual)
Extend equality check for objects.
|
static void |
assertNotEquals(java.lang.Object expected,
java.lang.Object actual)
Asserts that two objects are not equal.
|
static void |
assertNotEquals(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> |
assertValueInRange(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> |
assertValueInRange(T lowerLimit,
T upperLimit,
T actual)
Asserts that expected value belongs to a given numerical range .
|
static java.util.List |
list()
Returns an immutable empty list.
|
static java.util.List |
list(java.lang.Object object)
Returns an immutable list containing the given argument.
|
static java.util.List |
list(java.lang.Object object1,
java.lang.Object object2)
Returns a list containing the two given arguments.
|
static java.util.List |
list(java.lang.Object object1,
java.lang.Object object2,
java.lang.Object object3)
Returns a list containing the three given arguments.
|
static 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.
|
static java.util.Set |
set()
Gets an immutable empty set.
|
static java.util.Set |
set(java.lang.Object object)
Returns an immutable set containing the given argument.
|
static java.util.Set |
set(java.lang.Object object1,
java.lang.Object object2)
* Returns an immutable set containing the two given arguments.
|
static 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.
|
static 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.
|
protected <T> T |
singleElement(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.
|
public static void assertCollectionElements(java.util.Collection actual,
java.lang.Object... objects)
actual - collection which has to contain only given objectsobjects - objects that has to be existent in given collection and no other onepublic static void assertCollection(java.util.Collection expected,
java.util.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 java.lang.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 java.lang.Comparable> void assertValueInRange(java.lang.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(java.lang.String message,
java.util.Collection expected,
java.util.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(java.util.Collection<T> collection)
T - type of the elementcollection - collection from which the single element is neededpublic static final java.util.Set set()
public static final java.util.Set set(java.lang.Object object)
object - elementpublic static final java.util.Set set(java.lang.Object object1,
java.lang.Object object2)
object1 - first elementobject2 - second elementpublic static final java.util.Set set(java.lang.Object object1,
java.lang.Object object2,
java.lang.Object object3)
object1 - first elementobject2 - second elementobject3 - third elementpublic static final java.util.Set set(java.lang.Object object1,
java.lang.Object object2,
java.lang.Object object3,
java.lang.Object object4)
object1 - first elementobject2 - second elementobject3 - third elementobject4 - fourth elementpublic static final <T> java.util.List<T> toList(java.util.Collection<T> collection)
T - type of collection elementscollection - collection to convertpublic static final java.util.List list()
public static final java.util.List list(java.lang.Object object)
object - elementpublic static final java.util.List list(java.lang.Object object1,
java.lang.Object object2)
object1 - first elementobject2 - second elementpublic static final java.util.List list(java.lang.Object object1,
java.lang.Object object2,
java.lang.Object object3)
object1 - first elementobject2 - second elementobject3 - third elementpublic static final java.util.List list(java.lang.Object object1,
java.lang.Object object2,
java.lang.Object object3,
java.lang.Object object4)
object1 - first elementobject2 - second elementobject3 - third elementobject4 - fourth elementpublic static void assertEquals(java.lang.Object expected,
java.lang.Object actual)
Object.equals(Object) method in both directions and compares
the result of Object.hashCode().public static void assertNotEquals(java.lang.Object expected,
java.lang.Object actual)
public static void assertNotEquals(java.lang.String message,
java.lang.Object expected,
java.lang.Object actual)
Copyright © 2018 SAP SE. All Rights Reserved.