Author: hardy.ferentschik
Date: 2009-02-22 12:08:30 -0500 (Sun, 22 Feb 2009)
New Revision: 16018
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
Log:
updated a test
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-02-22
16:34:02 UTC (rev 16017)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java 2009-02-22
17:08:30 UTC (rev 16018)
@@ -38,6 +38,8 @@
import org.hibernate.validation.util.TestUtil;
import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
+import static junit.framework.Assert.fail;
+
/**
* Tests for the group and group sequence feature.
*
@@ -279,21 +281,29 @@
);
Iterator<ConstraintViolation<User>> iter =
constraintViolations.iterator();
-
- assertConstraintViolation(
- iter.next(),
- "may not be null",
- User.class,
- null,
- "defaultCreditCard"
- );
-
- assertConstraintViolation(
- iter.next(),
- "must match \"[0-9 -]?\"",
- User.class,
- "+46 123-456",
- "phoneNumber"
- );
+ while ( iter.hasNext() ) {
+ ConstraintViolation<User> violation = iter.next();
+ if ( violation.getPropertyPath().equals( "defaultCreditCard" ) ) {
+ assertConstraintViolation(
+ violation,
+ "may not be null",
+ User.class,
+ null,
+ "defaultCreditCard"
+ );
+ }
+ else if ( violation.getPropertyPath().equals( "phoneNumber" ) ) {
+ assertConstraintViolation(
+ violation,
+ "must match \"[0-9 -]?\"",
+ User.class,
+ "+46 123-456",
+ "phoneNumber"
+ );
+ }
+ else {
+ fail( "Unexpected violation" );
+ }
+ }
}
}
\ No newline at end of file
Show replies by date