001 package org.junit.experimental.theories;
002
003 import java.util.List;
004
005 /**
006 * Abstract parent class for suppliers of input data points for theories. Extend this class to customize how {@link
007 * org.junit.experimental.theories.Theories Theories} runner
008 * finds accepted data points. Then use your class together with <b>@ParametersSuppliedBy</b> on input
009 * parameters for theories.
010 *
011 * <p>
012 * For example, here is a supplier for values between two integers, and an annotation that references it:
013 *
014 * <pre>
015 * @Retention(RetentionPolicy.RUNTIME)
016 * <b>@ParametersSuppliedBy</b>(BetweenSupplier.class)
017 * public @interface Between {
018 * int first();
019 *
020 * int last();
021 * }
022 *
023 * public static class BetweenSupplier extends <b>ParameterSupplier</b> {
024 * @Override
025 * public List<<b>PotentialAssignment</b>> getValueSources(<b>ParameterSignature</b> sig) {
026 * List<<b>PotentialAssignment</b>> list = new ArrayList<PotentialAssignment>();
027 * Between annotation = (Between) sig.getSupplierAnnotation();
028 *
029 * for (int i = annotation.first(); i <= annotation.last(); i++)
030 * list.add(<b>PotentialAssignment</b>.forValue("ints", i));
031 * return list;
032 * }
033 * }
034 * </pre>
035 * </p>
036 *
037 * @see org.junit.experimental.theories.ParametersSuppliedBy
038 * @see org.junit.experimental.theories.Theories
039 * @see org.junit.experimental.theories.FromDataPoints
040 */
041 public abstract class ParameterSupplier {
042 public abstract List<PotentialAssignment> getValueSources(ParameterSignature sig) throws Throwable;
043 }