org.junit.experimental.theories
Annotation Type FromDataPoints
@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface FromDataPoints
Annotating a parameter of a @Theory
method with @FromDataPoints
will limit the
datapoints considered as potential values for that parameter to just the
DataPoints
with the given
name. DataPoint names can be given as the value parameter of the
@DataPoints annotation.
DataPoints without names will not be considered as values for any parameters
annotated with @FromDataPoints.
@DataPoints
public static String[] unnamed = new String[] { ... };
@DataPoints("regexes")
public static String[] regexStrings = new String[] { ... };
@DataPoints({"forMatching", "alphanumeric"})
public static String[] testStrings = new String[] { ... };
@Theory
public void stringTheory(String param) {
// This will be called with every value in 'regexStrings',
// 'testStrings' and 'unnamed'.
}
@Theory
public void regexTheory(@FromDataPoints("regexes") String regex,
@FromDataPoints("forMatching") String value) {
// This will be called with only the values in 'regexStrings' as
// regex, only the values in 'testStrings' as value, and none
// of the values in 'unnamed'.
}
- See Also:
Theory
,
DataPoint
,
DataPoints
value
public abstract String value
Copyright © 2002–2021 JUnit. All rights reserved.