HHH-7666 Replace unit tests' use of configuration()
This commit is contained in:
parent
b7cc064058
commit
8ecb9fdfdb
|
@ -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
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue