Class ConverterAssertion


  • public class ConverterAssertion
    extends Object
    The ConverterAssertion class contains utility methods to assure certain conditions. If any of the conditions do not fit, then a ConversionException is thrown.

    Hint: This class cannot be instantiated, it contains only static methods.

    Author:
    Michael Grammling - Initial contribution
    • Method Detail

      • assertNeitherNullNorEmpty

        public static void assertNeitherNullNorEmpty​(String propertyName,
                                                     String property)
                                              throws com.thoughtworks.xstream.converters.ConversionException
        Asserts that the specified property is neither null nor empty.
        Parameters:
        propertyName - the name of the property to be checked (must neither be null, nor empty)
        property - the property to be checked (could be null or empty)
        Throws:
        com.thoughtworks.xstream.converters.ConversionException - if the condition does not fit
      • assertEndOfType

        public static void assertEndOfType​(com.thoughtworks.xstream.io.HierarchicalStreamReader reader)
                                    throws com.thoughtworks.xstream.converters.ConversionException
        Asserts that the specified reader does not contain further elements in its section.
        Parameters:
        reader - the reader to be used for validation (must not be null)
        Throws:
        com.thoughtworks.xstream.converters.ConversionException - if the condition does not fit
      • assertNoAttribute

        public static void assertNoAttribute​(com.thoughtworks.xstream.io.HierarchicalStreamReader reader)
                                      throws com.thoughtworks.xstream.converters.ConversionException
        Asserts that the current node associated with the specified reader does not contain any attributes.
        Parameters:
        reader - the reader to be used for validation (must not be null)
        Throws:
        com.thoughtworks.xstream.converters.ConversionException - if the condition does not fit