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

org.hibernate.testing.junit5.BaseUnitTest Maven / Gradle / Ivy

/*
 * 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.junit5;

import org.hibernate.testing.orm.junit.ExpectedExceptionExtension;
import org.hibernate.testing.orm.junit.FailureExpectedExtension;
import org.junit.jupiter.api.extension.ExtendWith;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * @author Steve Ebersole
 */
@ExtendWith( FailureExpectedExtension.class )
@ExtendWith( ExpectedExceptionExtension.class )
public abstract class BaseUnitTest {

	@SuppressWarnings("unchecked")
	protected   T cast(Object thing, Class type) {
		assertThat( thing, instanceOf( type ) );
		return type.cast( thing );
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy