org.junit.contrib.theories
Annotation Type FromDataPoints


@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface FromDataPoints

Marking a parameter of a Theory method with this annotation will limit the data points considered as potential values for that parameter to only the DataPoints with the given name.

Data points 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:
DataPoint, DataPoints, Theories, Theory

Required Element Summary
 String value
           
 

Element Detail

value

public abstract String value


Copyright © 2014. All Rights Reserved.