HV-361 Adding test for @Range constraint
This commit is contained in:
parent
0cb3e66eef
commit
ff47006731
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue