Package net.tirasa.connid.commons.db
Class LocalizedAssert
java.lang.Object
net.tirasa.connid.commons.db.LocalizedAssert
Localized asserts is a set of localized asserts utility method that throws localized
exception when assert is not true.
Argument names passed into assert methods can also be localized
- Author:
- kitko
-
Constructor Summary
ConstructorDescriptionCreates asserts with messagesLocalizedAssert
(ConnectorMessages cm, boolean localizeArguments) Creates asserts with messages with flag whether to localize argument names -
Method Summary
Modifier and TypeMethodDescriptionassertBlank
(String s, String argument) Asserts that argument string is blank.assertNotBlank
(String o, String argument) Asserts that argument string is not blank.<T> T
assertNotNull
(T o, String argument) Asserts the argument is not null.<T> T
assertNull
(T o, String argument) Asserts the argument is null.
-
Constructor Details
-
LocalizedAssert
Creates asserts with messages- Parameters:
cm
- connector messages- Throws:
IllegalArgumentException
- if cm param is null
-
LocalizedAssert
Creates asserts with messages with flag whether to localize argument names- Parameters:
cm
- connector messageslocalizeArguments
- the arg- Throws:
IllegalArgumentException
- if cm param is null
-
-
Method Details
-
assertNotNull
Asserts the argument is not null. If argument is null, throws localized IllegalArgumentException.- Type Parameters:
T
- type of the object to check- Parameters:
o
- object to checkargument
- exception message- Returns:
- original obkect
-
assertNull
Asserts the argument is null. If argument is not null, throws localized IllegalArgumentException.- Type Parameters:
T
- type of the object to check- Parameters:
o
- object to checkargument
- exception message- Returns:
- original obkect
-
assertNotBlank
Asserts that argument string is not blank. If argument is null or blank, throws localized IllegalArgumentException- Parameters:
o
- object to checkargument
- exception message- Returns:
- original obkect
-
assertBlank
Asserts that argument string is blank. If argument is not blank, throws localized IllegalArgumentException- Parameters:
s
- string to checkargument
- exception message- Returns:
- original obkect
-