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

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

There is a newer version: 1.0.3
Show newest version
package io.github.bekoenig.assertj.schemacrawler.api;

import schemacrawler.schema.BaseColumn;
import schemacrawler.schema.ColumnDataType;
import schemacrawler.schema.DatabaseObject;

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

public abstract class AbstractBaseColumnAssert<
        SELF extends AbstractBaseColumnAssert,
        ACTUAL extends BaseColumn,
        PARENT extends DatabaseObject>
        extends AbstractDependantObjectAssert {

    protected AbstractBaseColumnAssert(ACTUAL actual, Class selfType) {
        super(actual, selfType);
    }

    public SELF satisfiesColumnDataType(Consumer requirement) {
        extracting(BaseColumn::getColumnDataType).satisfies(requirement);
        return myself;
    }

    public SELF matchesDecimalDigits(Predicate predicate) {
        extracting(BaseColumn::getDecimalDigits).matches(predicate);
        return myself;
    }

    public SELF matchesOrdinalPosition(Predicate predicate) {
        extracting(BaseColumn::getOrdinalPosition).matches(predicate);
        return myself;
    }

    public SELF matchesSize(Predicate predicate) {
        extracting(BaseColumn::getSize).matches(predicate);
        return myself;
    }

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

    public SELF matchesWidth(Predicate predicate) {
        extracting(BaseColumn::getWidth).matches(predicate);
        return myself;
    }

    public SELF isColumnDataTypeKnown(boolean expected) {
        return returns(expected, BaseColumn::getColumnDataType);
    }

    public SELF isNullable(boolean expected) {
        return returns(expected, BaseColumn::isNullable);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy