|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface DataPoints
Marking an array or iterable-typed field or method with this annotation will cause the values in the array
or iterable given to be used as potential value for theory parameters in that class when run with the
Theories runner.
Data Points will only be considered as potential values for parameters for which their types are assignable.
When multiple sets of DataPoints exist with overlapping types, more control can be obtained by naming the
data points using the value of this annotation, e.g. with @DataPoints({"dataset1", "dataset2"}),
and then specifying which named set to consider as potential values for each parameter using the
FromDataPoints annotation.
Parameters with no specified source will use all data points that are assignable to the parameter type as potential values, including named sets of data points.
Data points methods whose array types aren't assignable from the target parameter type (and so can't possibly return relevant values) will not be called when generating values for that parameter. Iterable-typed data points methods must always be called though, as this information is not available here after generic type erasure, so expensive methods returning iterable data points are a bad idea.
@DataPoints
public static String[] dataPoints = new String[] { ... };
@DataPoints
public static String[] generatedDataPoints() {
return new String[] { ... };
}
@Theory
public void theoryMethod(String param) {
...
}
DataPoint,
FromDataPoints,
Theories,
Theory| Optional Element Summary | |
|---|---|
Class<? extends Throwable>[] |
ignoredExceptions
|
String[] |
value
|
public abstract String[] value
public abstract Class<? extends Throwable>[] ignoredExceptions
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||