org.junit.experimental.theories.ParameterSupplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-curves4 Show documentation
Show all versions of virtdata-lib-curves4 Show documentation
Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4
package org.junit.experimental.theories;
import java.util.List;
/**
* Abstract parent class for suppliers of input data points for theories. Extend this class to customize how {@link
* org.junit.experimental.theories.Theories Theories} runner
* finds accepted data points. Then use your class together with @ParametersSuppliedBy on input
* parameters for theories.
*
*
* For example, here is a supplier for values between two integers, and an annotation that references it:
*
*
* @Retention(RetentionPolicy.RUNTIME)
* @ParametersSuppliedBy(BetweenSupplier.class)
* public @interface Between {
* int first();
*
* int last();
* }
*
* public static class BetweenSupplier extends ParameterSupplier {
* @Override
* public List<PotentialAssignment> getValueSources(ParameterSignature sig) {
* List<PotentialAssignment> list = new ArrayList<PotentialAssignment>();
* Between annotation = (Between) sig.getSupplierAnnotation();
*
* for (int i = annotation.first(); i <= annotation.last(); i++)
* list.add(PotentialAssignment.forValue("ints", i));
* return list;
* }
* }
*
*
*
* @see org.junit.experimental.theories.ParametersSuppliedBy
* @see org.junit.experimental.theories.Theories
* @see org.junit.experimental.theories.FromDataPoints
*/
public abstract class ParameterSupplier {
public abstract List getValueSources(ParameterSignature sig) throws Throwable;
}