public class DefaultDataProviderMethodResolver extends java.lang.Object implements DataProviderMethodResolver
UseDataProvider annotation.
It is being tried to resolve the dataprovider method using various strategies. The locations of the dataprovider can optionally
specified using UseDataProvider.location(). If no specific location is specified, test class itself is used (= where
@UseDataProvider annotation is used). If multiple locations are specified, each is searched for an appropriate
dataprovider.
The name of the dataprovider method can be explicitly set via UseDataProvider.value() or derived by convention. The first
found dataprovider method will be used. Here are the applied strategies:
UseDataProvider.value(). (no fallback if dataprovider could not be found)DataProvider annotated method which name equals the test method nameDataProvider annotated method whereby prefix is replaced by one out of the following:
| prefix | replacement |
|---|---|
| test | dataProvider |
| test | data |
DataProvider annotated method whereby additional prefix "dataProvider" or "data" is given. Also the first letter of the
original test method name is uppercased, e.g. shouldReturnTwoForOnePlusOne corresponds to
dataProviderShouldReturnTwoForOnePlusOne.| Constructor and Description |
|---|
DefaultDataProviderMethodResolver() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<org.junit.runners.model.TestClass> |
findDataProviderLocations(org.junit.runners.model.FrameworkMethod testMethod,
java.lang.Class<?>[] useDataProviderLocation) |
protected org.junit.runners.model.FrameworkMethod |
findDataProviderMethod(org.junit.runners.model.TestClass location,
java.lang.String testMethodName,
java.lang.String useDataProviderValue) |
protected java.util.List<org.junit.runners.model.FrameworkMethod> |
findDataProviderMethods(java.util.List<org.junit.runners.model.TestClass> locations,
java.lang.String testMethodName,
java.lang.String useDataProviderValue) |
java.util.List<org.junit.runners.model.FrameworkMethod> |
resolve(org.junit.runners.model.FrameworkMethod testMethod,
UseDataProvider useDataProvider)
Returns the dataprovider methods that belongs to the given test method or an empty
List if no such dataprovider method could
be found. |
public java.util.List<org.junit.runners.model.FrameworkMethod> resolve(org.junit.runners.model.FrameworkMethod testMethod,
UseDataProvider useDataProvider)
List if no such dataprovider method could
be found.
Look at the classes java doc for detailed description of the applied strategies.
resolve in interface DataProviderMethodResolvertestMethod - test method that uses a dataprovideruseDataProvider - UseDataProvider annoation on the given test methodList if dataprovider could not be found (never null)DefaultDataProviderMethodResolverprotected java.util.List<org.junit.runners.model.TestClass> findDataProviderLocations(org.junit.runners.model.FrameworkMethod testMethod,
java.lang.Class<?>[] useDataProviderLocation)
protected java.util.List<org.junit.runners.model.FrameworkMethod> findDataProviderMethods(java.util.List<org.junit.runners.model.TestClass> locations,
java.lang.String testMethodName,
java.lang.String useDataProviderValue)
protected org.junit.runners.model.FrameworkMethod findDataProviderMethod(org.junit.runners.model.TestClass location,
java.lang.String testMethodName,
java.lang.String useDataProviderValue)