io.cucumber.core.filter.Filters Maven / Gradle / Ivy
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);
}
}