org.junit.contrib.theories.ParametersSuppliedBy Maven / Gradle / Ivy
package org.junit.contrib.theories;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
/**
* Marking a {@link Theory} method parameter with this annotation causes it to be supplied with values from
* the named {@link ParameterSupplier} when run as a theory by the {@link Theories} runner.
*
* In addition, annotations themselves can be marked with this annotation, and then used similarly.
* ParameterSuppliedBy annotations on parameters are detected by searching up this hierarchy such that these act as
* syntactic sugar, making:
*
*
* @ParametersSuppliedBy(Supplier.class)
* public @interface SpecialParameter { }
*
* @Theory
* public void theoryMethod(@SpecialParameter String param) {
* ...
* }
*
*
* equivalent to:
*
*
* @Theory
* public void theoryMethod(@ParametersSuppliedBy(Supplier.class) String param) {
* ...
* }
*
*/
@Retention(RUNTIME)
@Target({ ANNOTATION_TYPE, PARAMETER })
public @interface ParametersSuppliedBy {
Class extends ParameterSupplier> value();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy