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

io.github.bekoenig.assertj.schemacrawler.api.AbstractForeignKeyAssert Maven / Gradle / Ivy

package io.github.bekoenig.assertj.schemacrawler.api;

import schemacrawler.schema.ForeignKey;
import schemacrawler.schema.ForeignKeyDeferrability;
import schemacrawler.schema.ForeignKeyUpdateRule;
import schemacrawler.schema.TableConstraintType;

import java.util.function.Consumer;
import java.util.function.Predicate;

public abstract class AbstractForeignKeyAssert>
        extends AbstractTableReferenceAssert {

    protected AbstractForeignKeyAssert(ForeignKey actual, Class selfType) {
        super(actual, selfType);
    }

    public SELF satisfiesDeferrability(Consumer requirement) {
        extracting(ForeignKey::getDeferrability).satisfies(requirement);
        return myself;
    }

    public SELF matchesDefinition(Predicate predicate) {
        extracting(ForeignKey::getDefinition).matches(predicate);
        return myself;
    }

    public SELF satisfiesDeleteRule(Consumer requirement) {
        extracting(ForeignKey::getDeleteRule).satisfies(requirement);
        return myself;
    }

    public SELF satisfiesType(Consumer requirement) {
        extracting(ForeignKey::getType).satisfies(requirement);
        return myself;
    }

    public SELF satisfiesUpdateRule(Consumer requirement) {
        extracting(ForeignKey::getUpdateRule).satisfies(requirement);
        return myself;
    }

    public SELF hasDefinition(boolean expected) {
        return returns(expected, ForeignKey::hasDefinition);
    }

    public SELF isDeferrable(boolean expected) {
        return returns(expected, ForeignKey::isDeferrable);
    }

    public SELF isInitiallyDeferred(boolean expected) {
        return returns(expected, ForeignKey::isInitiallyDeferred);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy