junitparams.internal.parameters.ParamsFromMethodCommon 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.parameters;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import junitparams.NamedParameters;
import org.junit.runners.model.FrameworkMethod;
import junitparams.Parameters;
import junitparams.internal.parameters.toarray.ParamsToArrayConverter;
class ParamsFromMethodCommon {
private final FrameworkMethod frameworkMethod;
ParamsFromMethodCommon(FrameworkMethod frameworkMethod) {
this.frameworkMethod = frameworkMethod;
}
Object[] paramsFromMethod(Class sourceClass) {
String methodAnnotation = frameworkMethod.getAnnotation(Parameters.class).method();
if (methodAnnotation.isEmpty()) {
return invokeMethodWithParams(defaultMethodName(), sourceClass);
}
List