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

io.github.bekoenig.assertj.schemacrawler.internal.NamedObjectUtils Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy