blob: 9d1ab7a5970715422702040369d3adec851205a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package junitparams.internal.parameters;
import javax.lang.model.type.NullType;
import org.junit.runners.model.FrameworkMethod;
import junitparams.Parameters;
class ParametersFromTestClassMethod implements ParametrizationStrategy {
private ParamsFromMethodCommon paramsFromMethodCommon;
private Class<?> testClass;
private Parameters annotation;
ParametersFromTestClassMethod(FrameworkMethod frameworkMethod, Class<?> testClass) {
paramsFromMethodCommon = new ParamsFromMethodCommon(frameworkMethod);
this.testClass = testClass;
annotation = frameworkMethod.getAnnotation(Parameters.class);
}
@Override
public Object[] getParameters() {
return paramsFromMethodCommon.paramsFromMethod(testClass);
}
@Override
public boolean isApplicable() {
return annotation != null
&& annotation.source().isAssignableFrom(NullType.class)
&& (!annotation.method().isEmpty() || paramsFromMethodCommon.containsDefaultParametersProvidingMethod(testClass));
}
}
|