public final class Assertions extends Object
Modifier and Type | Method and Description |
---|---|
static <C extends Iterable<String>> |
containsNoBlanks(String name,
C stringsNotBlank)
Throw and IllegalArgumentException if the passed collection is null or contains any blank
Strings.
|
static <C extends Iterable<?>> |
containsNoNulls(String name,
C containsNoNulls)
Throw an IllegalArgumentException if the passed collection is null or contains any null values.
|
static <C> C[] |
containsNoNulls(String name,
C[] containsNoNulls)
Throw an IllegalArgumentException if the passed array is null or contains any null values.
|
static <T> T |
equals(String name,
T expected,
T got) |
static void |
not(String name,
boolean condition)
Throw an IllegalArgumentException if the condition is true
|
static String |
notBlank(String name,
String string)
Throw an IllegalArgumentException if the string is null or blank (only contains whitespace)
|
static <T> T |
notNull(String name,
T notNull)
Throw an IllegalArgumentException if the string is null
|
static <T> T |
stateNotNull(String name,
T notNull)
State check.
|
static void |
stateTrue(String name,
boolean condition)
State check.
|
public static <T> T notNull(String name, T notNull) throws IllegalArgumentException
name
- added to the exceptionnotNull
- should not be nullIllegalArgumentException
- if nullpublic static <C extends Iterable<?>> C containsNoNulls(String name, C containsNoNulls) throws IllegalArgumentException
name
- name added to the exception.containsNoNulls
- the collection to check.IllegalArgumentException
- if the passed collection is null or contains any null.public static <C> C[] containsNoNulls(String name, C[] containsNoNulls) throws IllegalArgumentException
name
- name added to the exception.containsNoNulls
- the collection to check.IllegalArgumentException
- if the passed collection is null or contains any null.public static String notBlank(String name, String string) throws IllegalArgumentException
name
- added to the exceptionstring
- should not be null or blankIllegalArgumentException
- if null or blankpublic static <C extends Iterable<String>> C containsNoBlanks(String name, C stringsNotBlank)
C
- the type of the collection of strings.name
- name added to the exceptionstringsNotBlank
- the collection of strings that should not be blank.IllegalArgumentException
- if the passed collection is null or contains any blank strings.public static void not(String name, boolean condition) throws IllegalArgumentException
name
- added to the exceptioncondition
- should be falseIllegalArgumentException
- if truepublic static void stateTrue(String name, boolean condition) throws IllegalStateException
name
- added to the exceptioncondition
- should be trueIllegalStateException
- if falsepublic static <T> T stateNotNull(String name, T notNull)
name
- added to the exceptionnotNull
- should not be nullIllegalStateException
- if falsepublic static <T> T equals(String name, T expected, T got) throws IllegalArgumentException
IllegalArgumentException
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.