org.junit.contrib.theories
Annotation Type DataPoint


@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD})
public @interface DataPoint

Marking a field or method with this annotation will cause the field value or the value returned by the method to be used as a potential value for a theory parameter in that class, when run with the Theories runner.

A data point is only considered as a potential value for parameters for which its type is assignable. When multiple data points exist with overlapping types, more control can be obtained by naming each data point using the value of this annotation, e.g. with @DataPoint({"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.

 @DataPoint
 public static String dataPoint = "value";

 @DataPoint("generated")
 public static String generatedDataPoint() {
     return "generated value";
 }

 @Theory
 public void theoryMethod(String param) {
     ...
 }
 

See Also:
DataPoint, FromDataPoints, Theories, Theory

Optional Element Summary
 Class<? extends Throwable>[] ignoredExceptions
           
 String[] value
           
 

value

public abstract String[] value
Default:
{}

ignoredExceptions

public abstract Class<? extends Throwable>[] ignoredExceptions
Default:
{}


Copyright © 2014. All Rights Reserved.