Class Constructor<T>

  • All Implemented Interfaces:
    MockUnit<T>

    public class Constructor<T>
    extends java.lang.Object
    implements MockUnit<T>
    • Constructor Detail

      • Constructor

        public Constructor​(java.lang.Class<T> cls)
    • Method Detail

      • constructor

        public static <T> Constructor<T> constructor​(java.lang.Class<T> cls)

        Returns a new Constructor object.

        This method can be used to generate MockUnit<T> from a Java Bean <T> by accessing it's constructor and supply it with arbitrary input.

        Type Parameters:
        T - The type of MockUnit<T>. This is the wrapped type.
        Parameters:
        cls - The class for type <T>. (Eg.: Student.class)
        Returns:
        A new Constructor object. The Constructor class implements MockUnit<T>.
      • params

        public Constructor<T> params​(java.lang.Object... params)

        Specifies the values which are supplied to the constructor.

        As a param you can supply a MockUnit<T> or a constant value. If you chose to supply MockUnits the val() method will be automatically invoked.

        Parameters:
        params - A var-arg array of constant values or MockUnits.
        Returns:
        The current Constructor instance.
      • supplier

        public java.util.function.Supplier<T> supplier()
        Description copied from interface: MockUnit
        This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
        Specified by:
        supplier in interface MockUnit<T>
        Returns:
        A Supplier<T>.