HHH-7666 Replace unit tests' use of configuration()

This commit is contained in:
brmeyer 2012-10-11 18:35:25 -04:00
parent b7cc064058
commit 8ecb9fdfdb
4 changed files with 10 additions and 12 deletions

View File

@ -28,7 +28,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.hibernate.metamodel.spi.relational.Column;
import org.hibernate.metamodel.spi.relational.Index;
import org.hibernate.metamodel.spi.relational.PrimaryKey;
import org.hibernate.test.util.SchemaUtil;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.TestForIssue;
@ -54,9 +54,9 @@ public class DDLTest extends BaseCoreFunctionalTestCase {
@Test
public void testApplyOnIdColumn() throws Exception {
Index index = SchemaUtil.getIndexes( Tv.class, metadata() ).next();
PrimaryKey id = SchemaUtil.getPrimaryKey( Tv.class, metadata() );
assertEquals( "Validator annotation not applied on ids", 2,
index.getColumns().get( 0 ).getSize().getLength() );
id.getColumns().get( 0 ).getSize().getLength() );
}
@Test

View File

@ -289,8 +289,8 @@ public class IdTest extends BaseCoreFunctionalTestCase {
@Test
public void testColumnDefinition() {
Column idCol = SchemaUtil.getIndexes( Ball.class, metadata() )
.next().getColumns().get( 0 );
Column idCol = SchemaUtil.getPrimaryKey( Ball.class, metadata() )
.getColumns().get( 0 );
assertEquals( "ball_id", idCol.getColumnName().getText() );
}

View File

@ -316,8 +316,8 @@ public class IdTest extends BaseCoreFunctionalTestCase {
@Test
public void testColumnDefinition() {
Column idCol = SchemaUtil.getIndexes( Ball.class, metadata() )
.next().getColumns().get( 0 );
Column idCol = SchemaUtil.getPrimaryKey( Ball.class, metadata() )
.getColumns().get( 0 );
assertEquals( "ball_id", idCol.getColumnName().getText() );
}

View File

@ -23,13 +23,11 @@
*/
package org.hibernate.test.util;
import java.util.Iterator;
import org.hibernate.AssertionFailure;
import org.hibernate.metamodel.Metadata;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.relational.Column;
import org.hibernate.metamodel.spi.relational.Index;
import org.hibernate.metamodel.spi.relational.PrimaryKey;
import org.hibernate.metamodel.spi.relational.TableSpecification;
/**
@ -81,8 +79,8 @@ public abstract class SchemaUtil {
return getTable( tableName, metadata ).locateColumn( columnName );
}
public static Iterator<Index> getIndexes( Class<?> entityClass,
public static PrimaryKey getPrimaryKey( Class<?> entityClass,
Metadata metadata ) throws AssertionFailure {
return getTable( entityClass, metadata ).getIndexes().iterator();
return getTable( entityClass, metadata ).getPrimaryKey();
}
}