[hibernate-commits] Hibernate SVN: r16018 - validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Sun Feb 22 12:08:31 EST 2009


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




More information about the hibernate-commits mailing list