![JAR search and dependency download from the Maven repository](/logo.png)
junitparams.internal.annotation.FrameworkMethodAnnotations 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.internal.annotation;
import java.lang.annotation.Annotation;
import org.junit.runners.model.FrameworkMethod;
import junitparams.Parameters;
import junitparams.custom.CustomParameters;
public class FrameworkMethodAnnotations {
private final FrameworkMethod frameworkMethod;
public FrameworkMethodAnnotations(FrameworkMethod frameworkMethod) {
this.frameworkMethod = frameworkMethod;
}
public boolean isParametrised() {
return hasAnnotation(Parameters.class)
|| hasCustomParameters();
}
public Annotation[] allAnnotations() {
return frameworkMethod.getAnnotations();
}
public T getAnnotation(Class annotationType) {
return frameworkMethod.getAnnotation(annotationType);
}
public boolean hasAnnotation(Class extends Annotation> annotation) {
return getAnnotation(annotation) != null;
}
public boolean hasCustomParameters() {
return getCustomParameters() != null;
}
public CustomParametersDescriptor getCustomParameters() {
CustomParameters customParameters = frameworkMethod.getAnnotation(CustomParameters.class);
if (customParameters != null) {
return new CustomParametersDescriptor(customParameters);
}
for (Annotation annotation : frameworkMethod.getAnnotations()) {
customParameters = annotation.annotationType().getAnnotation(CustomParameters.class);
if (customParameters != null) {
return new CustomParametersDescriptor(customParameters, annotation);
}
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy