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 aContext
instance when invokingprovideValues(com.google.testing.junit.testparameterinjector.TestParameterValuesProvider.Context)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestParameterValuesProvider.Context
An 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
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 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)
TestParameterValue
value(Object wrappedValue)
Wraps the given value in an object that allows you to give the parameter value a different name.
-
-
-
Method Detail
-
provideValues
protected abstract List<?> provideValues(TestParameterValuesProvider.Context context) throws Exception
- Throws:
Exception
-
provideValues
@Deprecated public final List<?> provideValues()
Deprecated.This method should never be called as it will simply throw anUnsupportedOperationException
.- Specified by:
provideValues
in interfaceTestParameter.TestParameterValuesProvider
-
value
public final TestParameterValue value(@Nullable Object wrappedValue)
Wraps the given value in an object that allows you to give the parameter value a different name. The TestParameterInjector framework will recognize the returnedTestParameterValue
instances and unwrap them at injection time.Usage:
value(file.content).withName(file.name)
.- Specified by:
value
in interfaceTestParameter.TestParameterValuesProvider
-
-