Class OptionalShouldContainInstanceOf

  • All Implemented Interfaces:
    ErrorMessageFactory

    public class OptionalShouldContainInstanceOf
    extends BasicErrorMessageFactory
    Build an error message when a value should be instance of a specific class.
    Author:
    Alban Dericbourg
    • Constructor Detail

      • OptionalShouldContainInstanceOf

        private OptionalShouldContainInstanceOf​(String message)
    • Method Detail

      • shouldContainInstanceOf

        public static OptionalShouldContainInstanceOf shouldContainInstanceOf​(Object value,
                                                                              Class<?> clazz)
        Indicates that a value should be present in an empty Optional.
        Parameters:
        value - Optional to be checked.
        clazz - the class to check the optional value against
        Returns:
        an error message factory.
        Throws:
        NullPointerException - if optional is null.