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

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy