Takes the element value, the name and the index as parameters and invokes RequireUtils#fail if requirements isn't satisfied.
Takes the value and the name as parameters and invokes RequireUtils#fail if requirements isn't satisfied.
Fails test.
Fails test. Must be invoked at every time when requireXXX
method fails. Default implementation
throws an IllegalArgumentException
with message built by RequireUtils#failureMessage method.
Override this implementation if you want another failure behaviour of all requireXXX
methods of this objects.
For example if you want to throw MyApiException
use this code:
override def fail(message: => Any) = { throw new MyApiException(failureMessage(message)) }
a String
to include in the failure message
Builds the failure message of any requireXXX
method.
Builds the failure message of any requireXXX
method. Default implementation concatenates
prefix returned by RequireUtils#prefix method followed by message
followed by postfix
returned by RequireUtils#postfix method.
Override this implementation if you want to intercept or change rules of building failure messages.
the source message
the failure message
Invokes require
function if value
is Some(_) and do nothing otherwise.
Invokes require
function if value
is Some(_) and do nothing otherwise.
the type of value
the value
the function
the postfix of any requireXXX
method failure message string
the prefix of any requireXXX
method failure message string
Tests an expression, invoking RequireUtils#fail if false.
Tests an expression, invoking RequireUtils#fail if false.
the expression to test
a String
to include in the failure message
Tests that all elements of iterable value
satisfy the predicate
, and
otherwise throws IllegalArgumentException
.
Tests that all elements of iterable value
satisfy the predicate
, and
otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable value
the name to include in the failure message
the function
Tests that iterable value
does not contain blank (null
or empty) strings, and
otherwise throws IllegalArgumentException
.
Tests that iterable value
does not contain blank (null
or empty) strings, and
otherwise throws IllegalArgumentException
.
the iterable value
the name to include in the failure message
Tests that iterable value
does not contain null
values, and
otherwise throws IllegalArgumentException
.
Tests that iterable value
does not contain null
values, and
otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable value
the name to include in the failure message
Tests that at least one of elems of seq
is contained in value
Tests that at least one of elems of seq
is contained in value
the type of value
the value
the name to include in the failure message
the sequence of values
is allow duplicates
Tests that value
is a Byte
number string, and otherwise throws IllegalArgumentException
.
Tests that value
is a Byte
number string, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is a Double
number string, and otherwise throws IllegalArgumentException
.
Tests that value
is a Double
number string, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that string email
is a correct email address.
Tests that string email
is a correct email address.
the testing email string
the name to include in the failure message
Tests that value
is a Float
number string, and otherwise throws IllegalArgumentException
.
Tests that value
is a Float
number string, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is an Int
number string, and otherwise throws IllegalArgumentException
.
Tests that value
is an Int
number string, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is a Long
number string, and otherwise throws IllegalArgumentException
.
Tests that value
is a Long
number string, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is negative, and otherwise throws IllegalArgumentException
.
Tests that value
is negative, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is positive or zero, and otherwise throws IllegalArgumentException
.
Tests that value
is positive or zero, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is negative or zero, and otherwise throws IllegalArgumentException
.
Tests that value
is negative or zero, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that sequence value
isn't null
or empty, and otherwise throws IllegalArgumentException
.
Tests that sequence value
isn't null
or empty, and otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable to test
Tests that sequence value
isn't null
or empty, and otherwise throws IllegalArgumentException
.
Tests that sequence value
isn't null
or empty, and otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable to test
the name to include in the failure message
Tests that value
isn't null
or empty (after trim
), and otherwise throws IllegalArgumentException
.
Tests that value
isn't null
or empty (after trim
), and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
isn't null
, and otherwise throws IllegalArgumentException
.
Tests that value
isn't null
, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Test that value
is equal to number
, and otherwise throws IllegalArgumentException
.
Test that value
is equal to number
, and otherwise throws IllegalArgumentException
.
the type of iterable elements
the value
the required number
Tests that value
is from leftBound
with bound type leftBoundType
until maximum value of type T
(inclusive).
Tests that value
is from leftBound
with bound type leftBoundType
until maximum value of type T
(inclusive).
the type of value
the value
the left bound
the left bound type
Tests that value
is from leftBound
(exclusive) until maximum value of type T
(inclusive).
Tests that value
is from leftBound
(exclusive) until maximum value of type T
(inclusive).
the type of value
the value
the left bound
Tests that value
is from leftBound
with bound type leftBoundType
until rightBound
with bound type rightBoundType
.
Tests that value
is from leftBound
with bound type leftBoundType
until rightBound
with bound type rightBoundType
.
the type of value
the value
the left bound
the left bound type
the right bound
the right bound type
Tests that value
is from leftBound
(exclusive) until rightBound
(exclusive).
Tests that value
is from leftBound
(exclusive) until rightBound
(exclusive).
the type of value
the value
the left bound
the right bound
Tests that value
is from leftBound
(inclusive) until rightBound
(inclusive).
Tests that value
is from leftBound
(inclusive) until rightBound
(inclusive).
the type of value
the value
the left bound
the right bound
Tests that value
is from minimum value of type T
(inclusive)
until rightBound
with bound type rightBoundType
.
Tests that value
is from minimum value of type T
(inclusive)
until rightBound
with bound type rightBoundType
.
the type of value
the value
the right bound
the right bound type
Tests that one and only one of elems of seq
is contained in value
Tests that one and only one of elems of seq
is contained in value
the type of value
the value
the name to include in the failure message
the sequence of values
is allow duplicates
Tests that value
matches regular expression pattern, and otherwise throws IllegalArgumentException
.
Tests that value
matches regular expression pattern, and otherwise throws IllegalArgumentException
.
the value to test
the pattern to test
the name to include in the failure message
Tests that value
is positive, and otherwise throws IllegalArgumentException
.
Tests that value
is positive, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that value
is a Short
number string, and otherwise throws IllegalArgumentException
.
Tests that value
is a Short
number string, and otherwise throws IllegalArgumentException
.
the value to test
the name to include in the failure message
Tests that size of iterable value
equals expected size
, and otherwise throws IllegalArgumentException
.
Tests that size of iterable value
equals expected size
, and otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable value
the expected size
the name to include in the failure message
Tests that size of iterable value
is from from
inclusive until Int.MaxValue,
and otherwise throws IllegalArgumentException
.
Tests that size of iterable value
is from from
inclusive until Int.MaxValue,
and otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable value
the minimum size value (inclusive)
the name to include in the failure message
Tests that size of iterable value
is from from
inclusive until until
exclusive,
and otherwise throws IllegalArgumentException
.
Tests that size of iterable value
is from from
inclusive until until
exclusive,
and otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable value
the minimum size value (inclusive)
the maximum size value (exclusive)
the name to include in the failure message
Tests that size of iterable value
is from 0
inclusive until until
exclusive,
and otherwise throws IllegalArgumentException
.
Tests that size of iterable value
is from 0
inclusive until until
exclusive,
and otherwise throws IllegalArgumentException
.
the type of iterable elements
the iterable value
the maximum size value (exclusive)
the name to include in the failure message
Tests that string uuid
is a correct universally unique identifier (UUID).
Tests that string uuid
is a correct universally unique identifier (UUID).
the testing uuid string
the name to include in the failure message
Translates RequireFunction (for example RequireUtils.requireNotBlank(value:String* or RequireUtils#requireNotNull) to RequireElementFunction to use with RequireUtils#requireAll method.
Translates RequireFunction (for example RequireUtils.requireNotBlank(value:String* or RequireUtils#requireNotNull) to RequireElementFunction to use with RequireUtils#requireAll method.
Default implementation concatenates name and index in string name(index)
.
the type of iterable elements
the function to translate
the translated function
Validation utility methods.
0.0.1