[hibernate-commits] Hibernate SVN: r17102 - in beanvalidation/trunk/validation-tck/src/main: java/org/hibernate/jsr303/tck/tests/validation/graphnavigation and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Jul 15 11:25:25 EDT 2009


Author: hardy.ferentschik
Date: 2009-07-15 11:25:24 -0400 (Wed, 15 Jul 2009)
New Revision: 17102

Added:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Animal.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/AnimalCaretaker.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Condor.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Elephant.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Zoo.java
Removed:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ChildFirst.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ParentSecond.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ProperOrder.java
Modified:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Child.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/GraphNavigationTest.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Parent.java
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
   beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
added mappings around graph validation

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -210,6 +210,7 @@
 	@Test
 	@SpecAssertions({
 			@SpecAssertion(section = "2.4", id = "o"),
+			@SpecAssertion(section = "3.1.3", id = "c"),
 			@SpecAssertion(section = "4.2", id = "h")
 	})
 	public void testGraphValidationWithArray() {

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Animal.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Animal.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Animal.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -0,0 +1,24 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Animal {
+}

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/AnimalCaretaker.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/AnimalCaretaker.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/AnimalCaretaker.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -0,0 +1,34 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class AnimalCaretaker {
+	@Valid
+	Map<String, Animal> caresFor = new HashMap<String, Animal>();
+
+	public void addAnimal(String name, Animal animal) {
+		caresFor.put( name, animal );
+	}
+}

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Child.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Child.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Child.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -25,7 +25,7 @@
 public class Child {
 	private String name;
 
-	@NotNull(groups = ChildFirst.class)
+	@NotNull(groups = Parent.ChildFirst.class)
 	public String getName() {
 		return name;
 	}

Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ChildFirst.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ChildFirst.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ChildFirst.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -1,24 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
-
-/**
- * @author Emmanuel Bernard
- */
-public interface ChildFirst {
-}
\ No newline at end of file

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Condor.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Condor.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Condor.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -0,0 +1,36 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
+
+import javax.validation.constraints.Min;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Condor extends Animal {
+	@Min(value = 250, message = "The wingspan of a condor is at least 250 cm")
+	private int wingspan;
+
+	public int getWingspan() {
+		return wingspan;
+	}
+
+	public void setWingspan(int wingspan) {
+		this.wingspan = wingspan;
+	}
+}

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Elephant.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Elephant.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Elephant.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -0,0 +1,36 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
+
+import javax.validation.constraints.Min;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Elephant extends Animal {
+	@Min(value = 1000, message = "An elephant weighs at least 1000 kg")
+	private int weight;
+
+	public int getWeight() {
+		return weight;
+	}
+
+	public void setWeight(int weight) {
+		this.weight = weight;
+	}
+}

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/GraphNavigationTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/GraphNavigationTest.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/GraphNavigationTest.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -31,6 +31,8 @@
 import org.testng.annotations.Test;
 
 import org.hibernate.jsr303.tck.util.TestUtil;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
 import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectPropertyPaths;
 
 
@@ -38,11 +40,13 @@
  * @author Hardy Ferentschik
  */
 @Artifact(artifactType = ArtifactType.JSR303)
- at Classes({TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class})
+ at Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
 public class GraphNavigationTest extends AbstractTest {
 
 	@Test
 	@SpecAssertions({
+			@SpecAssertion(section = "3.1.3", id = "a"),
+			@SpecAssertion(section = "3.1.3", id = "k"),
 			@SpecAssertion(section = "3.5.1", id = "a"),
 			@SpecAssertion(section = "3.5.1", id = "b")
 	})
@@ -72,7 +76,7 @@
 		Validator validator = TestUtil.getDefaultValidator();
 
 		Set<ConstraintViolation<Order>> constraintViolations = validator.validate( order );
-		assertEquals( constraintViolations.size(), 3, "Wrong number of constraints" );
+		assertCorrectNumberOfViolations( constraintViolations, 3 );
 		assertCorrectPropertyPaths(
 				constraintViolations,
 				"shippingAddress.addressline1",
@@ -82,7 +86,10 @@
 	}
 
 	@Test
-	@SpecAssertion(section = "3.5.1", id = "d")
+	@SpecAssertions({
+			@SpecAssertion(section = "3.1.3", id = "f"),
+			@SpecAssertion(section = "3.5.1", id = "d")
+	})
 	public void testNoEndlessLoop() {
 		User john = new User( "John", null );
 		john.knows( john );
@@ -101,28 +108,79 @@
 		john.knows( jane );
 
 		constraintViolations = validator.validate( john );
-		assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+		assertCorrectNumberOfViolations( constraintViolations, 1 );
 		TestUtil.assertConstraintViolation(
 				constraintViolations.iterator().next(), User.class, null, "lastName"
 		);
 
 		constraintViolations = validator.validate( jane );
-		assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+		assertCorrectNumberOfViolations( constraintViolations, 1 );
 		TestUtil.assertConstraintViolation(
 				constraintViolations.iterator().next(), User.class, null, "knowsUser[0].lastName"
 		);
 
 		john.setLastName( "Doe" );
 		constraintViolations = validator.validate( john );
-		assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+		assertCorrectNumberOfViolations( constraintViolations, 0 );
 	}
 
 	@Test
+	@SpecAssertions({
+			@SpecAssertion(section = "3.1.3", id = "d"),
+			@SpecAssertion(section = "3.1.3", id = "j")
+	})
+	public void testTypeOfContainedValueIsDeterminedAtRuntime() {
+		Zoo zoo = new Zoo();
+		Elephant elephant = new Elephant();
+		elephant.setWeight( 500 );
+		zoo.addAnimal( elephant );
+
+		Condor condor = new Condor();
+		condor.setWingspan( 200 );
+		zoo.addAnimal( condor );
+
+		Validator validator = TestUtil.getDefaultValidator();
+		Set<ConstraintViolation<Zoo>> constraintViolations = validator.validate( zoo );
+		assertCorrectNumberOfViolations( constraintViolations, 2 );
+		assertCorrectConstraintViolationMessages(
+				constraintViolations,
+				"The wingspan of a condor is at least 250 cm",
+				"An elephant weighs at least 1000 kg"
+		);
+
+	}
+
+	@Test
+	@SpecAssertions({
+			@SpecAssertion(section = "3.1.3", id = "g"),
+			@SpecAssertion(section = "3.1.3", id = "i")
+	})
+	public void testContainedMap() {
+		AnimalCaretaker caretaker = new AnimalCaretaker();
+		Elephant elephant = new Elephant();
+		elephant.setWeight( 500 );
+		caretaker.addAnimal( "Jumbo", elephant );
+
+		Condor condor = new Condor();
+		condor.setWingspan( 200 );
+		caretaker.addAnimal( "Andes", condor );
+
+		Validator validator = TestUtil.getDefaultValidator();
+		Set<ConstraintViolation<AnimalCaretaker>> constraintViolations = validator.validate( caretaker );
+		assertCorrectNumberOfViolations( constraintViolations, 2 );
+		assertCorrectPropertyPaths(
+				constraintViolations,
+				"caresFor[Jumbo].weight",
+				"caresFor[Andes].wingspan"
+		);
+	}
+
+	@Test
 	public void testFullGraphValidationBeforeNextGroupInSequence() {
 		Parent p = new Parent();
 		p.setChild( new Child() );
 		Validator validator = TestUtil.getDefaultValidator();
-		Set<ConstraintViolation<Parent>> errors = validator.validate( p, ProperOrder.class );
+		Set<ConstraintViolation<Parent>> errors = validator.validate( p, Parent.ProperOrder.class );
 		assertEquals( 1, errors.size() );
 		assertCorrectPropertyPaths( errors, "child.name" );
 	}

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Parent.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Parent.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Parent.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -17,8 +17,9 @@
 */
 package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
 
+import javax.validation.GroupSequence;
+import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
-import javax.validation.Valid;
 
 /**
  * @author Emmanuel Bernard
@@ -44,4 +45,14 @@
 	public void setChild(Child child) {
 		this.child = child;
 	}
+
+	public interface ParentSecond {
+	}
+
+	public interface ChildFirst {
+	}
+
+	@GroupSequence({ ChildFirst.class, ParentSecond.class })
+	public interface ProperOrder {
+	}
 }
\ No newline at end of file

Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ParentSecond.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ParentSecond.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ParentSecond.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -1,24 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
-
-/**
- * @author Emmanuel Bernard
- */
-public interface ParentSecond {
-}
\ No newline at end of file

Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ProperOrder.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ProperOrder.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/ProperOrder.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -1,27 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
-
-import javax.validation.GroupSequence;
-
-/**
- * @author Emmanuel Bernard
- */
- at GroupSequence( {ChildFirst.class, ParentSecond.class } )
-public interface ProperOrder {
-}
\ No newline at end of file

Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Zoo.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Zoo.java	                        (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/Zoo.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -0,0 +1,38 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.validation.graphnavigation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Zoo {
+	@Valid
+	Collection<Animal> inhabitants = new ArrayList<Animal>();
+
+	public Collection<Animal> getInhabitants() {
+		return inhabitants;
+	}
+
+	public void addAnimal(Animal animal) {
+		inhabitants.add( animal );
+	}
+}

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java	2009-07-15 15:25:24 UTC (rev 17102)
@@ -116,7 +116,7 @@
 				}
 			}
 			if ( !containsPath ) {
-				fail( expectedPath + " is not in the list of path instances contained in the actual constraint violations" );
+				fail( expectedPath + " is not in the list of path instances contained in the actual constraint violations: " + propertyPathsOfViolations );
 			}
 		}
 	}
@@ -213,7 +213,7 @@
 		 *
 		 * @see <a href="http://www.regexplanet.com/simple/index.jsp">Regular expression tester</a>
 		 */
-		private static final Pattern pathPattern = Pattern.compile( "(\\w+)(\\[(\\w?)\\])?(\\.(.*))*" );
+		private static final Pattern pathPattern = Pattern.compile( "(\\w+)(\\[(\\w*)\\])?(\\.(.*))*" );
 
 		private static final String PROPERTY_PATH_SEPERATOR = ".";
 

Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml	2009-07-15 15:24:21 UTC (rev 17101)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml	2009-07-15 15:25:24 UTC (rev 17102)
@@ -286,18 +286,33 @@
                 array or iterator to be validated</text>
         </assertion>
         <assertion id="d">
-            <text>The following types are supported, any array of objects, java.util.Collection,
-                java.util.Set, java.util.List, java.util.Map and any object implementing
-                java.lang.Iterable </text>
+            <text>Array of objects is supported by @Valid</text>
         </assertion>
-        <assertion id="e">
+        <assertion id="e" >
+            <text>java.util.Collection is supported by @Valid
+                 </text>
+        </assertion>
+        <assertion id="f">
+            <text>java.util.Set is supported by @Valid</text>
+        </assertion>
+        <assertion  id="g">
+            <text>java.util.List is supported by @Valid</text>
+        </assertion>
+        <assertion  id="h">
+            <text>java.util.Map is supported by @Valid
+                </text>
+        </assertion>
+        <assertion id="i">
+            <text>java.lang.Iterable is supported by @Valid</text>
+        </assertion>  
+        <assertion id="j">
             <text>For Map, the value of each entry is validated (the key is not validated)</text>
         </assertion>
-        <assertion id="f">
-            <text>Like regular references, its type is determined at runtime and the constraint
+        <assertion id="k">
+            <text>Like regular references, the type of the collection, array or Iterable element is determined at runtime and the constraint
                 definitions for this particular type are used</text>
         </assertion>
-        <assertion id="g">
+        <assertion id="l">
             <text>The @Valid annotation is applied recursively</text>
         </assertion>
     </section>




More information about the hibernate-commits mailing list