com.browserup.bup.assertion.field.FieldPassesPredicateAssertion Maven / Gradle / Ivy
package com.browserup.bup.assertion.field;
import com.browserup.bup.assertion.HarEntryAssertion;
import com.browserup.bup.assertion.error.HarEntryAssertionError;
import com.browserup.harreader.model.HarEntry;
import java.util.Optional;
public abstract class FieldPassesPredicateAssertion implements HarEntryAssertion {
public abstract HarEntryAssertionFieldSupplier getFieldSupplier();
public abstract HarEntryPredicate getHarEntryPredicate();
@Override
public Optional assertion(HarEntry entry) {
FieldType input = getFieldSupplier().apply(entry);
return getHarEntryPredicate().test(input).map(HarEntryAssertionError::new);
}
}