junitparams.converters.Converter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JUnitParams Show documentation
Show all versions of JUnitParams Show documentation
Better parameterised tests for JUnit
package junitparams.converters;
import java.lang.annotation.Annotation;
/**
* Defines the logic to convert parameter annotated with A to type T. Converter must have a public no-args constructor. Configuration is
* done via {@link Converter#initialize(java.lang.annotation.Annotation)} method
* Inspired by javax.validation.ConstraintValidator
*
* @param type of annotation mentioning this converter
* @param conversion target type
*/
public interface Converter {
/**
* Initializes this converter - you can read your annotation config here.
*/
void initialize(A annotation);
/**
* Converts param to desired type.
*
* @throws ConversionFailedException
*/
T convert(Object param) throws ConversionFailedException;
}