abstractormappingtests.java

来自「一个hibernate的自动测试框架源码」· Java 代码 · 共 58 行

JAVA
58
字号
package net.chrisrichardson.ormunit.hibernate;

import java.util.Set;


/**
 * Implements behavior common to both HibernateMappingTests (old version) and HibernateORMappingTests
 * @author cer
 *
 */
public abstract class AbstractORMappingTests extends HibernateORMTestCase {

	protected HibernateMappingChecker mappingChecker;
	protected MappedClassChecker classChecker;


	protected void onSetUp() throws Exception {
		super.onSetUp();
		this.mappingChecker = new HibernateMappingChecker(getConfiguration());
	}

	/**
	 * Specifies whether to use field mapping or property mapping
	 * @param accessStrategy
	 */
	protected void setAccessStrategy(AccessStrategy accessStrategy) {
		mappingChecker.setAccessStrategy(accessStrategy);
	}

	/**
	 * Verify that the class is mapped to the specified table
	 * 
	 * @param type
	 * @param tableName
	 */
	protected void assertClassMapping(Class type, String tableName) {
		HibernateMappingChecker r = this.mappingChecker;
		classChecker = r.getClassChecker(type);
		classChecker.assertClassMapping(type, tableName);
	}

	/**
	 * Verify that all classes and their fields/properties are mapped
	 */
	protected void assertAllClassesMapped() {
		mappingChecker.assertAllClassesMapped();
	}

	/**
	 * Verify that all classes and properties/properties are mapped except the specified fields/properties
	 * @param unmappedProperties
	 */
	protected void assertAllClassesMapped(Set<String> unmappedProperties) {
		mappingChecker.assertAllClassesMapped(unmappedProperties);
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?