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

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

There is a newer version: 7.0.0.Beta2
Show newest version
/*
 * 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 org.hamcrest.BaseMatcher;
import org.hamcrest.Description;

/**
 * @author Steve Ebersole
 */
public class AssignableMatcher extends BaseMatcher {
	public static AssignableMatcher assignableTo(Class expected) {
		return new AssignableMatcher( expected );
	}

	private final Class expected;

	public AssignableMatcher(Class expected) {
		this.expected = expected;
	}

	@Override
	public boolean matches(Object item) {
		return expected.isAssignableFrom( (Class) item );
	}

	@Override
	public void describeTo(Description description) {
		description.appendText( "assignable to " ).appendText( expected.getName() );
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy