Package com.atlassian.bamboo.performance
Class Assertions
java.lang.Object
com.atlassian.bamboo.performance.Assertions
Utility class with design by contract checks.
- Since:
- v3.13
-
Method Summary
Modifier and TypeMethodDescriptioncontainsNoBlanks
(String name, C stringsNotBlank) Throw and IllegalArgumentException if the passed collection is null or contains any blank Strings.static <C extends Iterable<?>>
CcontainsNoNulls
(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
static void
Throw an IllegalArgumentException if the condition is truestatic String
Throw an IllegalArgumentException if the string is null or blank (only contains whitespace)static <T> T
Throw an IllegalArgumentException if the string is nullstatic <T> T
stateNotNull
(String name, T notNull) State check.static void
State check.
-
Method Details
-
notNull
Throw an IllegalArgumentException if the string is null- Parameters:
name
- added to the exceptionnotNull
- should not be null- Returns:
- argument being checked.
- Throws:
IllegalArgumentException
- if null
-
containsNoNulls
public static <C extends Iterable<?>> C containsNoNulls(String name, C containsNoNulls) throws IllegalArgumentException Throw an IllegalArgumentException if the passed collection is null or contains any null values.- Parameters:
name
- name added to the exception.containsNoNulls
- the collection to check.- Returns:
- the passed in Iterable.
- Throws:
IllegalArgumentException
- if the passed collection is null or contains any null.
-
containsNoNulls
public static <C> C[] containsNoNulls(String name, C[] containsNoNulls) throws IllegalArgumentException Throw an IllegalArgumentException if the passed array is null or contains any null values.- Parameters:
name
- name added to the exception.containsNoNulls
- the collection to check.- Returns:
- the passed in Iterable.
- Throws:
IllegalArgumentException
- if the passed collection is null or contains any null.
-
notBlank
Throw an IllegalArgumentException if the string is null or blank (only contains whitespace)- Parameters:
name
- added to the exceptionstring
- should not be null or blank- Returns:
- argument being checked.
- Throws:
IllegalArgumentException
- if null or blank
-
containsNoBlanks
Throw and IllegalArgumentException if the passed collection is null or contains any blank Strings.- Type Parameters:
C
- the type of the collection of strings.- Parameters:
name
- name added to the exceptionstringsNotBlank
- the collection of strings that should not be blank.- Returns:
- the passed argument.
- Throws:
IllegalArgumentException
- if the passed collection is null or contains any blank strings.
-
not
Throw an IllegalArgumentException if the condition is true- Parameters:
name
- added to the exceptioncondition
- should be false- Throws:
IllegalArgumentException
- if true
-
stateTrue
State check. Throw an IllegalStateException if the condition is false- Parameters:
name
- added to the exceptioncondition
- should be true- Throws:
IllegalStateException
- if false
-
stateNotNull
State check. Throw an IllegalStateException if the supplied argument is null.- Parameters:
name
- added to the exceptionnotNull
- should not be null- Returns:
- argument being checked.
- Throws:
IllegalStateException
- if false
-
equals
- Throws:
IllegalArgumentException
-