All Downloads are FREE. Search and download functionalities are using the official Maven repository.

junitparams.internal.ParametrizedTestMethodsFilter Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy