Class Constructor<T>
java.lang.Object
net.andreinc.mockneat.unit.objects.Constructor<T>
- All Implemented Interfaces:
MockUnit<T>
public class Constructor<T> extends java.lang.Object implements MockUnit<T>
-
Constructor Summary
Constructors Constructor Description Constructor(java.lang.Class<T> cls) -
Method Summary
Modifier and Type Method Description static <T> Constructor<T>constructor(java.lang.Class<T> cls)Returns a newConstructorobject.Constructor<T>params(java.lang.Object... params)Specifies the values which are supplied to the constructor.java.util.function.Supplier<T>supplier()This is the sole abstract method of the interface.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
Constructor Details
-
Method Details
-
constructor
Returns a new
Constructorobject.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 ofMockUnit<T>. This is the wrapped type.- Parameters:
cls- The class for type<T>. (Eg.: Student.class)- Returns:
- A new
Constructorobject. TheConstructorclass implementsMockUnit<T>.
-
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 supplyMockUnits theval()method will be automatically invoked.- Parameters:
params- A var-arg array of constant values orMockUnits.- Returns:
- The current
Constructorinstance.
-
supplier
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-