![JAR search and dependency download from the Maven repository](/logo.png)
de.tsl2.nano.autotest.creator.InverseFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.autotest Show documentation
Show all versions of tsl2.nano.autotest Show documentation
Generates unit tests from code or annotated methods
The newest version!
package de.tsl2.nano.autotest.creator;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotate your method to define it as an inverse function of another known
* function. Will be used to do automatic unit test creation with randomized
* parameters - without coding.
*
* So, the call of {@link #methodName()} should create a result that can be
* inverted by calling the inverse function (the annotated method itself). The
* origin parameter value has to be equal to the result of the inverse function.
*
*
* @author Tom
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
public @interface InverseFunction {
/** class that declares the method (default: same class) */
Class declaringType() default Object.class;
/** method that is the origin - or to be called before the own inverse method */
String methodName();
/** all parameter types of the given methodName */
Class[] parameters() default {};
/**
* reuse calling parameter of first function (see methodName) on call of the
* inverse function (the method, having this annotation)
*
* the content of the int array are the parameter indexes of the first function
* - to be filled in the order of the inverse function parameters.
*
* -1: fill the returned result instead of a parameter.
* -2: fill any random value on that inverse parameter index
*/
int[] bindParameterIndexesOnInverse() default {-1};
/**
* whitch parameter or result (returned result = -1) should be used to compare
* with inverse function
*/
int compareParameterIndex() default -1;
/**
* which parameter or result of own inverse function should be compare with the
* origin function
*/
int compareInverseParameterIndex() default -1;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy