Modifier and Type | Method and Description |
---|---|
static <T> T |
assertAmong(T obj,
T... list)
Check that object is presented among provided elements and replace the object by equal element from the list.
|
static <T extends Collection<?>> |
assertDoesntContainNull(T collection)
Assert that collection doesn't contain null value.
|
static <T> T[] |
assertDoesntContainNull(T[] array)
Assert that array doesn't contain null value.
|
static <T> T |
assertEquals(T etalon,
T value)
Assert that value is equal to some etalon value.
|
static void |
assertFalse(String message,
boolean condition)
Assert condition flag is FALSE.
|
static <T> T |
assertIsValid(T obj,
Validator<T> validator)
Check an object by a validator.
|
static <T extends Disposable> |
assertNotDisposed(T disposable)
Assert that a disposable object is not disposed.
|
static <T> T |
assertNotNull(String failMessage,
T object)
Assert that value is not null
|
static <T> T |
assertNotNull(T object)
Assert that value is not null
|
static <T> T |
assertNull(String failMessage,
T object)
Assert that value is null
|
static <T> T |
assertNull(T object)
Assert that value is null
|
static void |
assertTrue(String message,
boolean condition)
Assert condition flag is TRUE.
|
static Error |
fail(String message)
Throw assertion error for some cause
|
public static Error fail(String message)
message
- description of the cause.AssertionError
- will be thrownpublic static <T> T assertNull(T object)
T
- type of the object to checkobject
- the object to checkAssertionError
- it will be thrown if the value is not nullpublic static <T> T assertNull(String failMessage, T object)
T
- type of the object to checkfailMessage
- the message to be provided for failure, can be nullobject
- the object to checkAssertionError
- it will be thrown if the value is not nullpublic static <T> T assertNotNull(T object)
T
- type of the object to checkobject
- the object to checkAssertionError
- it will be thrown if the value is nullpublic static <T> T assertNotNull(String failMessage, T object)
T
- type of the object to checkfailMessage
- the message to be provided as error description, can be nullobject
- the object to checkAssertionError
- it will be thrown if the value is nullpublic static <T> T[] assertDoesntContainNull(T[] array)
T
- type of the object to checkarray
- an array to be checked for null valueAssertionError
- it will be thrown if either array is null or it contains nullpublic static void assertTrue(String message, boolean condition)
message
- message describing situationcondition
- condition which must be trueAssertionError
- if the condition is not truepublic static <T> T assertEquals(T etalon, T value)
T
- type of object to be checked.etalon
- etalon valuevalue
- value to checkAssertionError
- if the value id not equal to the etalonpublic static void assertFalse(String message, boolean condition)
message
- message describing situationcondition
- condition which must be falseAssertionError
- if the condition is truepublic static <T extends Collection<?>> T assertDoesntContainNull(T collection)
T
- type of collection to checkcollection
- a collection to be checked for null valueAssertionError
- it will be thrown if either collection is null or it contains nullpublic static <T extends Disposable> T assertNotDisposed(T disposable)
T
- type of the objectdisposable
- disposable object to be checkedAlreadyDisposedError
- it will be thrown if the object is already disposed;public static <T> T assertAmong(T obj, @MayContainNull T... list)
T
- type of objectobj
- object to be checkedlist
- list of elements for checkingAssertionError
- if object is not found among defined onespublic static <T> T assertIsValid(T obj, Validator<T> validator)
T
- object typeobj
- object to be checkedvalidator
- validator for the operationInvalidObjectError
- will be thrown if the object is invalidCopyright © 2011–2020 Igor Maznitsa. All rights reserved.