io.github.bekoenig.assertj.schemacrawler.internal.NamedObjectUtils 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.internal;
import schemacrawler.schema.NamedObject;
import java.util.List;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
public class NamedObjectUtils {
private NamedObjectUtils() {
}
public static T findOne(List namedObjects, String name) {
assertThat(namedObjects).isNotNull();
assertThat(name).isNotNull();
List columns = namedObjects.stream()
.filter(y -> y.getName()
.equals(name))
.collect(Collectors.toList());
assertThat(columns).hasSizeBetween(0, 1);
return columns.isEmpty() ? null : columns.get(0);
}
}