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

org.hibernate.testing.hamcrest.CollectionMatchers Maven / Gradle / Ivy

/*
 * SPDX-License-Identifier: LGPL-2.1-or-later
 * Copyright Red Hat Inc. and Hibernate Authors
 */
package org.hibernate.testing.hamcrest;

import java.util.Collection;

import org.hamcrest.Matcher;

/**
 * @author Steve Ebersole
 */
public class CollectionMatchers {
	private static final CollectionEmptinessMatcher IS_EMPTY = new CollectionEmptinessMatcher( true );
	private static final CollectionEmptinessMatcher IS_NOT_EMPTY = new CollectionEmptinessMatcher( false );

	public static Matcher isEmpty() {
		return IS_EMPTY;
	}

	public static Matcher isNotEmpty() {
		return IS_NOT_EMPTY;
	}

	public static Matcher> hasSize(int size) {
		return org.hamcrest.Matchers.hasSize( size );
	}

	public static > HasNullElementsMatcher hasNullElements() {
		//noinspection unchecked
		return HasNullElementsMatcher.HAS_NULL_ELEMENTS_MATCHER;
	}

	public static > HasNullElementsMatcher hasNoNullElements() {
		//noinspection unchecked
		return HasNullElementsMatcher.HAS_NO_NULL_ELEMENTS_MATCHER;
	}

	public static > Matcher isInitialized() {
		return InitializationCheckMatcher.isInitialized();
	}

	public static > Matcher isNotInitialized() {
		return InitializationCheckMatcher.isNotInitialized();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy