fr.vergne.pester.util.namer.PredicateNamer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pester-core Show documentation
Show all versions of pester-core Show documentation
Implementation of the Pester library.
The newest version!
package fr.vergne.pester.util.namer;
import java.util.Optional;
import java.util.function.Predicate;
import fr.vergne.pester.util.argscheck.ArgsCheck;
public class PredicateNamer implements Namer {
private final String defaultName;
private final Predicate namePredicate;
public PredicateNamer(String defaultName, Predicate namePredicate) {
this.defaultName = ArgsCheck.requireNonNull(defaultName, "No default name provided");
this.namePredicate = ArgsCheck.requireNonNull(namePredicate, "No name predicate provided");
}
@Override
public Optional getExpectedName() {
return Optional.empty();
}
@Override
public Predicate getNamePredicate() {
return namePredicate;
}
@Override
public String getDefaultName() {
return defaultName;
}
}