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

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

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

import org.assertj.core.api.FactoryBasedNavigableIterableAssert;
import schemacrawler.schema.CheckOptionType;
import schemacrawler.schema.Table;
import schemacrawler.schema.View;

import java.util.Collection;
import java.util.function.Consumer;

public abstract class AbstractViewAssert>
        extends AbstractTableAssert {

    protected AbstractViewAssert(View actual, Class selfType) {
        super(actual, selfType);
    }

    public SELF satisfiesCheckOption(Consumer requirement) {
        extracting(View::getCheckOption).satisfies(requirement);
        return myself;
    }

    public FactoryBasedNavigableIterableAssert, Table, TableAssert> tableUsage() {
        isNotNull();
        return new FactoryBasedNavigableIterableAssert<>(
                actual.getTableUsage(),
                FactoryBasedNavigableIterableAssert.class, SchemaCrawlerAssertions::assertThat);
    }

    public SELF isUpdatable(boolean expected) {
        return returns(expected, View::isUpdatable);
    }

    public TableAssert table(String schemaName, String tableName) {
        return extracting(x -> x.lookupTable(x.getSchema(), tableName).orElse(null))
                .asInstanceOf(SchemaCrawlerInstanceOfAssertFactories.table());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy