HV-361 Adding test for @Range constraint

This commit is contained in:
Hardy Ferentschik 2010-11-11 17:29:25 +01:00
parent 0cb3e66eef
commit ff47006731
1 changed files with 22 additions and 4 deletions

View File

@ -65,6 +65,23 @@ public class DDLWithoutCallbackTest extends TestCase {
s.close();
}
@RequiresDialectFeature(DialectChecks.SupportsColumnCheck.class)
public void testRangeChecksGetApplied() {
Range range = new Range( 1 );
assertDatabaseConstraintViolationThrown( range );
range = new Range( 11 );
assertDatabaseConstraintViolationThrown( range );
range = new Range( 5 );
Session s = openSession();
Transaction tx = s.beginTransaction();
s.persist( range );
s.flush();
tx.rollback();
s.close();
}
public void testDDLEnabled() {
PersistentClass classMapping = getCfg().getClassMapping( Address.class.getName() );
Column countryColumn = (Column) classMapping.getProperty( "country" ).getColumnIterator().next();
@ -81,7 +98,8 @@ public class DDLWithoutCallbackTest extends TestCase {
return new Class<?>[] {
Address.class,
CupHolder.class,
MinMax.class
MinMax.class,
Range.class
};
}