junitparams.internal.ParametrizedTestMethodsFilter 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;
import java.util.ArrayList;
import java.util.List;
import org.junit.runner.manipulation.Filter;
import org.junit.runners.model.FrameworkMethod;
import junitparams.JUnitParamsRunner;
public class ParametrizedTestMethodsFilter {
private final junitparams.JUnitParamsRunner jUnitParamsRunner;
private final Filter filter;
public ParametrizedTestMethodsFilter(junitparams.JUnitParamsRunner jUnitParamsRunner, Filter filter) {
this.jUnitParamsRunner = jUnitParamsRunner;
this.filter = filter;
}
public ParametrizedTestMethodsFilter(JUnitParamsRunner jUnitParamsRunner) {
this.jUnitParamsRunner = jUnitParamsRunner;
this.filter = Filter.ALL;
}
public List filteredMethods(List frameworkMethods) {
List filteredMethods = new ArrayList();
for (FrameworkMethod frameworkMethod : frameworkMethods) {
if (filter.shouldRun(jUnitParamsRunner.describeMethod(frameworkMethod))) {
filteredMethods.add(frameworkMethod);
}
}
return filteredMethods;
}
}