Package com.helger.commons.mock
Class CommonsMock.Param
java.lang.Object
com.helger.commons.mock.CommonsMock.Param
- Enclosing class:
CommonsMock
This class represents a parameter description for a single mockable type.
It consists of a parameter name (purely informational), parameter class
(required) and a generic supplier.
- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CommonsMock.ParamcreateConstant(String sParamName, boolean bDefault) static <T> CommonsMock.ParamcreateConstant(String sParamName, Class<T> aParamClass, T aDefault) Create aCommonsMock.Paramwith a constant default value.Class<?> toString()
-
Constructor Details
-
Param
public Param(@Nonnull @Nonempty String sParamName, @Nonnull Class<T> aParamClass, @Nonnull Supplier<T> aDefaultValueSupplier) Constructor for a mock parameter- Type Parameters:
T- data type of the parameter- Parameters:
sParamName- Name of the parameter - informational only. May neither benullnor empty.aParamClass- The class of the parameter. May neither benullnor empty.aDefaultValueSupplier- The default value supplier in case the caller did not provide an argument. May not benull.
-
-
Method Details
-
getParamName
-
getParamClass
-
getDefaultValue
-
toString
-
createConstant
@Nonnull public static CommonsMock.Param createConstant(@Nonnull @Nonempty String sParamName, boolean bDefault) -
createConstant
@Nonnull public static <T> CommonsMock.Param createConstant(@Nonnull @Nonempty String sParamName, @Nonnull Class<T> aParamClass, @Nullable T aDefault) Create aCommonsMock.Paramwith a constant default value.- Type Parameters:
T- data type create the constant of- Parameters:
sParamName- Parameter name. May neither benullnor empty.aParamClass- The parameter class. May not benull.aDefault- The constant default value to be used. May benull.- Returns:
- The
CommonsMock.Paramobject and nevernull.
-