io.github.bekoenig.assertj.schemacrawler.api.AbstractRoutineAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of assertj-schemacrawler Show documentation
Show all versions of assertj-schemacrawler Show documentation
An assertj extension for schema-crawler.
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, List, 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());
}
}