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

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

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

import schemacrawler.schema.*;

import java.util.List;
import java.util.function.Predicate;

public class AbstractRoutineAssert<
        SELF extends AbstractRoutineAssert,
        ACTUAL extends Routine>
        extends AbstractDatabaseObjectAssert {

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

    public , P extends Routine> ListableNamedObjectAssert, C, RoutineParameterAssert> parameters() {
        isNotNull();
        return new ListableNamedObjectAssert<>(
                actual.getParameters(),
                SchemaCrawlerAssertions::assertThat);
    }

    public SELF hasReturnType(RoutineReturnType expected) {
        extracting(Routine::getReturnType).isEqualTo(expected);
        return myself;
    }

    public SELF hasRoutineBodyType(RoutineBodyType expected) {
        extracting(Routine::getRoutineBodyType).isEqualTo(expected);
        return myself;
    }

    public SELF hasRoutineType(RoutineType expected) {
        extracting(Routine::getRoutineType).isEqualTo(expected);
        return myself;
    }

    public SELF matchesSpecificName(Predicate predicate) {
        extracting(Routine::getSpecificName).matches(predicate);
        return myself;
    }

    public RoutineParameterAssert parameter(String name) {
        return extracting(x -> x.lookupParameter(name).orElse(null))
                .asInstanceOf(SchemaCrawlerInstanceOfAssertFactories.routineParameter());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy