Class 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 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 messages
        localizeArguments - 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 check
        argument - 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 check
        argument - 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 check
        argument - exception message
        Returns:
        original obkect
      • assertBlank

        public String assertBlank​(String s,
                                  String argument)
        Asserts that argument string is blank. If argument is not blank, throws localized IllegalArgumentException
        Parameters:
        s - string to check
        argument - exception message
        Returns:
        original obkect