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

io.cucumber.core.filter.Filters Maven / Gradle / Ivy

There is a newer version: 7.18.0
Show newest version
package io.cucumber.core.filter;

import io.cucumber.core.gherkin.Pickle;

import java.net.URI;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.regex.Pattern;

public final class Filters implements Predicate {

    private Predicate filter = t -> true;

    public Filters(Options options) {
        List tagExpressions = options.getTagExpressions();
        if (!tagExpressions.isEmpty()) {
            this.filter = this.filter.and(new TagPredicate(tagExpressions));
        }
        List nameFilters = options.getNameFilters();
        if (!nameFilters.isEmpty()) {
            this.filter = this.filter.and(new NamePredicate(nameFilters));
        }
        Map> lineFilters = options.getLineFilters();
        if (!lineFilters.isEmpty()) {
            this.filter = this.filter.and(new LinePredicate(lineFilters));
        }
    }

    @Override
    public boolean test(Pickle pickle) {
        return this.filter.test(pickle);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy