org.hibernate.testing.hamcrest.CollectionMatchers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-testing Show documentation
Show all versions of hibernate-testing Show documentation
Support for testing Hibernate ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
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();
}
}