001package org.junit.experimental.theories;
002
003import 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>&#064;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 *     &#064;Retention(RetentionPolicy.RUNTIME)
016 *     <b>&#064;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 *         &#064;Override
025 *         public List&lt;<b>PotentialAssignment</b>&gt; getValueSources(<b>ParameterSignature</b> sig) {
026 *             List&lt;<b>PotentialAssignment</b>&gt; list = new ArrayList&lt;PotentialAssignment&gt;();
027 *             Between annotation = (Between) sig.getSupplierAnnotation();
028 *
029 *             for (int i = annotation.first(); i &lt;= 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 */
041public abstract class ParameterSupplier {
042    public abstract List<PotentialAssignment> getValueSources(ParameterSignature sig) throws Throwable;
043}