Package net.tirasa.connid.commons.db
Class LocalizedAssert
- java.lang.Object
-
- net.tirasa.connid.commons.db.LocalizedAssert
-
public class LocalizedAssert extends Object
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
Constructors Constructor Description LocalizedAssert(org.identityconnectors.framework.common.objects.ConnectorMessages cm)Creates asserts with messagesLocalizedAssert(org.identityconnectors.framework.common.objects.ConnectorMessages cm, boolean localizeArguments)Creates asserts with messages with flag whether to localize argument names
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringassertBlank(String s, String argument)Asserts that argument string is blank.StringassertNotBlank(String o, String argument)Asserts that argument string is not blank.<T> TassertNotNull(T o, String argument)Asserts the argument is not null.<T> TassertNull(T o, String argument)Asserts the argument is null.
-
-
-
Constructor Detail
-
LocalizedAssert
public LocalizedAssert(org.identityconnectors.framework.common.objects.ConnectorMessages cm)
Creates asserts with messages- Parameters:
cm- connector messages- Throws:
IllegalArgumentException- if cm param is null
-
LocalizedAssert
public LocalizedAssert(org.identityconnectors.framework.common.objects.ConnectorMessages cm, boolean localizeArguments)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 Detail
-
assertNotNull
public <T> T assertNotNull(T o, String argument)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
public <T> T assertNull(T o, String argument)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
public String assertNotBlank(String o, String argument)
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
-
-