Package org.junit.experimental.theories
Annotation Type DataPoint
-
@Retention(RUNTIME) @Target({FIELD,METHOD}) public @interface DataPoint
Annotating an field or method with @DataPoint will cause the field value or the value returned by the method to be used as a potential parameter for theories in that class, when run with theTheories
runner.A DataPoint is only considered as a potential value for parameters for which its type is assignable. When multiple
DataPoint
s exist with overlapping types more control can be obtained by naming each DataPoint 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 (i.e. without @FromDataPoints or other
@ParameterSuppliedBy
annotations) will use allDataPoint
s that are assignable to the parameter type as potential values, including named sets ofDataPoint
s.@DataPoint public static String dataPoint = "value"; @DataPoint("generated") public static String generatedDataPoint() { return "generated value"; } @Theory public void theoryMethod(String param) { ... }
- See Also:
Theories
,Theory
,DataPoint
,FromDataPoints
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.Class<? extends java.lang.Throwable>[]
ignoredExceptions
java.lang.String[]
value
-
-
-
Element Detail
-
value
java.lang.String[] value
- Default:
- {}
-
-
-
ignoredExceptions
java.lang.Class<? extends java.lang.Throwable>[] ignoredExceptions
- Default:
- {}
-
-