Package org.trustdeck.utils
Class Assertion
java.lang.Object
org.trustdeck.utils.Assertion
This class encapsulates utility functionalities.
- Author:
- Eric Wündisch and Armin Müller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleanassertNotNullAll(Object... assertObjects) Method that checks whether any one of the given objects is not null.static BooleanassertNullAll(Object... assertObjects) Method that checks whether all of the given objects are null.static booleanisJsonEmpty(com.fasterxml.jackson.databind.JsonNode node) Helper method to check if a given JSON is empty.static booleanisNotNullOrEmpty(String value) Method that checks whether the given String is not null nor empty.static booleanisNotNullOrEmpty(String... values) Method that checks whether a list of given Strings is not null nor empty.static booleanisNullOrEmpty(String value) Method that checks whether the given String is null or empty.static booleanisNullOrEmpty(String... values) Method that checks whether a list of given Strings is null or empty.
-
Constructor Details
-
Assertion
public Assertion()
-
-
Method Details
-
assertNotNullAll
Method that checks whether any one of the given objects is not null.- Parameters:
assertObjects- a list of objects that should be checked- Returns:
trueonly if none of the passed objects are null,falseotherwise.
-
assertNullAll
Method that checks whether all of the given objects are null.- Parameters:
assertObjects- a list of objects that should be checked- Returns:
trueonly if all of the passed objects are null,falseotherwise.
-
isNullOrEmpty
Method that checks whether the given String is null or empty.- Parameters:
value- the String to check- Returns:
trueonly if the passed object is a string and null or empty,falseotherwise.
-
isNullOrEmpty
Method that checks whether a list of given Strings is null or empty.- Parameters:
values- the String to check- Returns:
trueonly if the passed objects are strings and null or empty,falseotherwise.
-
isNotNullOrEmpty
Method that checks whether the given String is not null nor empty.- Parameters:
value- the String to check- Returns:
trueonly if the passed object is a string and neither null nor empty,falseotherwise.
-
isNotNullOrEmpty
Method that checks whether a list of given Strings is not null nor empty.- Parameters:
values- the String to check- Returns:
trueonly if the passed objects are strings and neither null nor empty,falseotherwise.
-
isJsonEmpty
public static boolean isJsonEmpty(com.fasterxml.jackson.databind.JsonNode node) Helper method to check if a given JSON is empty.- Parameters:
node- the JSON to check- Returns:
trueif the JSON is empty,falseotherwise
-