open static fun notEmpty(@Nullable array: Array<Any>, message: String): Unit
Assert that an array contains elements; that is, it must not be null
and must contain at least one element.
Assert.notEmpty(array, "The array must contain elements");
message
- the exception message to use if the assertion fails
IllegalArgumentException
- if the object array is null
or contains no elements
open static fun notEmpty(@Nullable array: Array<Any>, messageSupplier: Supplier<String>): Unit
Assert that an array contains elements; that is, it must not be null
and must contain at least one element.
Assert.notEmpty(array, () -> "The " + arrayType + " array must contain elements");
messageSupplier
- a supplier for the exception message to use if the assertion fails
IllegalArgumentException
- if the object array is null
or contains no elements
Since
5.0
open static fun notEmpty(@Nullable array: Array<Any>): Unit
open static fun notEmpty(@Nullable collection: MutableCollection<*>): Unit
open static fun notEmpty(@Nullable map: MutableMap<*, *>): Unit
open static fun notEmpty(@Nullable collection: MutableCollection<*>, message: String): Unit
Assert that a collection contains elements; that is, it must not be null
and must contain at least one element.
Assert.notEmpty(collection, "Collection must contain elements");
collection
- the collection to check
message
- the exception message to use if the assertion fails
IllegalArgumentException
- if the collection is null
or contains no elements
open static fun notEmpty(@Nullable collection: MutableCollection<*>, messageSupplier: Supplier<String>): Unit
Assert that a collection contains elements; that is, it must not be null
and must contain at least one element.
Assert.notEmpty(collection, () -> "The " + collectionType + " collection must contain elements");
collection
- the collection to check
messageSupplier
- a supplier for the exception message to use if the assertion fails
IllegalArgumentException
- if the collection is null
or contains no elements
Since
5.0
open static fun notEmpty(@Nullable map: MutableMap<*, *>, message: String): Unit
Assert that a Map contains entries; that is, it must not be null
and must contain at least one entry.
Assert.notEmpty(map, "Map must contain entries");
message
- the exception message to use if the assertion fails
IllegalArgumentException
- if the map is null
or contains no entries
open static fun notEmpty(@Nullable map: MutableMap<*, *>, messageSupplier: Supplier<String>): Unit
Assert that a Map contains entries; that is, it must not be null
and must contain at least one entry.
Assert.notEmpty(map, () -> "The " + mapType + " map must contain entries");
messageSupplier
- a supplier for the exception message to use if the assertion fails
IllegalArgumentException
- if the map is null
or contains no entries
Since
5.0