Class TestParameterValuesProvider
java.lang.Object
com.google.testing.junit.testparameterinjector.TestParameterValuesProvider
- All Implemented Interfaces:
TestParameter.TestParameterValuesProvider
public abstract class TestParameterValuesProvider extends Object implements TestParameter.TestParameterValuesProvider
Abstract class for custom providers of @TestParameter values.
This is a replacement for TestParameter.TestParameterValuesProvider, which is
deprecated. The difference with the former interface is that this class provides a
Context instance when invoking provideValues(com.google.testing.junit.testparameterinjector.TestParameterValuesProvider.Context).
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestParameterValuesProvider.ContextAn immutable value class that contains extra information about the context of the parameter for which values are being provided. -
Constructor Summary
Constructors Constructor Description TestParameterValuesProvider() -
Method Summary
Modifier and Type Method Description List<?>provideValues()Deprecated.This method should never be called as it will simply throw anUnsupportedOperationException.protected abstract List<?>provideValues(TestParameterValuesProvider.Context context)TestParameterValuevalue(Object wrappedValue)Wraps the given value in an object that allows you to give the parameter value a different name.
-
Constructor Details
-
TestParameterValuesProvider
public TestParameterValuesProvider()
-
-
Method Details
-
provideValues
protected abstract List<?> provideValues(TestParameterValuesProvider.Context context) throws Exception- Throws:
Exception
-
provideValues
Deprecated.This method should never be called as it will simply throw anUnsupportedOperationException.- Specified by:
provideValuesin interfaceTestParameter.TestParameterValuesProvider
-
value
Wraps the given value in an object that allows you to give the parameter value a different name. The TestParameterInjector framework will recognize the returnedTestParameterValueinstances and unwrap them at injection time.Usage:
value(file.content).withName(file.name).- Specified by:
valuein interfaceTestParameter.TestParameterValuesProvider
-