Author: hardy.ferentschik
Date: 2009-06-22 17:06:03 -0400 (Mon, 22 Jun 2009)
New Revision: 16866
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/bootstrap/defaultprovider/BootstrapTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/builtinconstraints/BuiltinConstraintsTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/GroupTest.java
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/ValidateValueTest.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/traversableresolver/SnifferTraversableResolver.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/ConstraintValidatorContextTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
Log:
started integrating the new path API
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/bootstrap/defaultprovider/BootstrapTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/bootstrap/defaultprovider/BootstrapTest.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/bootstrap/defaultprovider/BootstrapTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -31,6 +31,7 @@
import javax.validation.Configuration;
import javax.validation.ConstraintViolation;
import javax.validation.MessageInterpolator;
+import javax.validation.Path;
import javax.validation.TraversableResolver;
import javax.validation.Validation;
import javax.validation.Validator;
@@ -73,8 +74,7 @@
Set<ConstraintViolation<Person>> constraintViolations = validator.validate(
person );
assertEquals( constraintViolations.size(), 3, "Wrong number of constraints"
);
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "firstName", "lastName",
"personalNumber" }
+ constraintViolations, "firstName", "lastName",
"personalNumber"
);
person.setFirstName( "John" );
@@ -244,15 +244,12 @@
}
private static class DummyTraversableResolver implements TraversableResolver {
- public boolean isReachable(Object traversableObject, String traversableProperty,
Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
- return false;
- }
- public boolean isCascadable(Object traversableObject, String traversableProperty,
Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ public boolean isReachable(Object traversableObject, Path.Node traversableProperty,
Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
return false;
}
- public boolean isTraversable(Object traversableObject, String traversableProperty,
Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ public boolean isCascadable(Object traversableObject, Path.Node traversableProperty,
Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
return false;
}
}
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/builtinconstraints/BuiltinConstraintsTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/builtinconstraints/BuiltinConstraintsTest.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/builtinconstraints/BuiltinConstraintsTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -178,8 +178,7 @@
// only the min constraints on the primitive values should fail. Object values re still
null and should pass per spec
assertCorrectNumberOfViolations( constraintViolations, 4 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive" }
+ constraintViolations, "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive"
);
@@ -198,8 +197,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 6 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "byteObject", "intObject", "longObject",
"shortObject", "bigDecimal", "bigInteger" }
+ constraintViolations, "byteObject", "intObject",
"longObject", "shortObject", "bigDecimal",
"bigInteger"
);
dummy.intObject = Integer.valueOf( "101" );
@@ -231,8 +229,7 @@
// only the max constraints on the primitive values should fail. Object values re still
null and should pass per spec
assertCorrectNumberOfViolations( constraintViolations, 4 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive" }
+ constraintViolations, "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive"
);
@@ -251,8 +248,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 6 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "byteObject", "intObject", "longObject",
"shortObject", "bigDecimal", "bigInteger" }
+ constraintViolations, "byteObject", "intObject",
"longObject", "shortObject", "bigDecimal",
"bigInteger"
);
dummy.intObject = Integer.valueOf( "101" );
@@ -279,8 +275,7 @@
// only the min constraints on the primitive values should fail. Object values re still
null and should pass per spec
assertCorrectNumberOfViolations( constraintViolations, 4 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive" }
+ constraintViolations, "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive"
);
@@ -299,8 +294,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 6 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "byteObject", "intObject", "longObject",
"shortObject", "bigDecimal", "bigInteger" }
+ constraintViolations, "byteObject", "intObject",
"longObject", "shortObject", "bigDecimal",
"bigInteger"
);
dummy.intObject = Integer.valueOf( "101" );
@@ -332,8 +326,7 @@
// only the max constraints on the primitive values should fail. Object values re still
null and should pass per spec
assertCorrectNumberOfViolations( constraintViolations, 4 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive" }
+ constraintViolations, "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive"
);
@@ -352,8 +345,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 6 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "byteObject", "intObject", "longObject",
"shortObject", "bigDecimal", "bigInteger" }
+ constraintViolations, "byteObject", "intObject",
"longObject", "shortObject", "bigDecimal",
"bigInteger"
);
dummy.intObject = Integer.valueOf( "101" );
@@ -396,8 +388,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 5 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "collection", "map", "string",
"integerArray", "intArray" }
+ constraintViolations, "collection", "map", "string",
"integerArray", "intArray"
);
dummy.collection.remove( "bar" );
@@ -427,8 +418,7 @@
// only the max constraints on the primitive values should fail. Object values re still
null and should pass per spec
assertCorrectNumberOfViolations( constraintViolations, 4 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive" }
+ constraintViolations, "bytePrimitive", "intPrimitive",
"longPrimitive", "shortPrimitive"
);
@@ -447,8 +437,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 6 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "byteObject", "intObject", "longObject",
"shortObject", "bigDecimal", "bigInteger" }
+ constraintViolations, "byteObject", "intObject",
"longObject", "shortObject", "bigDecimal",
"bigInteger"
);
dummy.intObject = Integer.valueOf( "1" );
@@ -483,8 +472,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 2 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "date", "calendar" }
+ constraintViolations, "date", "calendar"
);
cal.add( Calendar.YEAR, -2 );
@@ -515,8 +503,7 @@
constraintViolations = validator.validate( dummy );
assertCorrectNumberOfViolations( constraintViolations, 2 );
assertCorrectPropertyPaths(
- constraintViolations,
- new String[] { "date", "calendar" }
+ constraintViolations, "date", "calendar"
);
cal.add( Calendar.YEAR, 2 );
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -34,7 +34,7 @@
}
if ( "00000".equals( zip ) ) {
constraintValidatorContext.disableDefaultError();
- constraintValidatorContext.addError( "00000 is a reserved code" );
+ constraintValidatorContext.buildErrorWithMessageTemplate( "00000 is a reserved
code" ).addError();
return false;
}
else {
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/GroupTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/GroupTest.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/GroupTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -38,6 +38,7 @@
import org.testng.annotations.Test;
import org.hibernate.jsr303.tck.util.TestUtil;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectPropertyPaths;
/**
* Tests for the group and group sequence feature.
@@ -181,7 +182,7 @@
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
assertEquals( constraintViolation.getInvalidValue(), book.getTitle(), "Wrong
value" );
- assertEquals( "title", constraintViolation.getPropertyPath(), "Wrong
propertyName" );
+ assertEquals( constraintViolation.getPropertyPath().toString(), "title",
"Wrong propertyName" );
book.setTitle( "Hibernate Persistence with JPA" );
book.setSubtitle( "Revised Edition of Hibernate in Action" );
@@ -189,10 +190,10 @@
constraintViolations = validator.validate( book, First.class, Second.class, Last.class
);
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
constraintViolation = constraintViolations.iterator().next();
- assertEquals( "size must be between 0 and 30",
constraintViolation.getMessage(), "Wrong message" );
+ assertEquals( constraintViolation.getMessage(), "size must be between 0 and
30", "Wrong message" );
assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
assertEquals( constraintViolation.getInvalidValue(), book.getSubtitle(), "Wrong
value" );
- assertEquals( "subtitle", constraintViolation.getPropertyPath(), "Wrong
propertyName" );
+ assertCorrectPropertyPaths(constraintViolations, "subtitle");
book.setSubtitle( "Revised Edition" );
author.setCompany( "JBoss a divison of RedHat" );
@@ -200,10 +201,10 @@
constraintViolations = validator.validate( book, First.class, Second.class, Last.class
);
constraintViolation = constraintViolations.iterator().next();
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
- assertEquals( "size must be between 0 and 20",
constraintViolation.getMessage() );
+ assertEquals( constraintViolation.getMessage(), "size must be between 0 and
20" );
assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
assertEquals( constraintViolation.getInvalidValue(), author.getCompany(), "Wrong
value" );
- assertEquals( "author.company", constraintViolation.getPropertyPath(),
"Wrong propertyName" );
+ assertCorrectPropertyPaths(constraintViolations, "author.company");
author.setCompany( "JBoss" );
@@ -230,10 +231,10 @@
constraintViolations = validator.validate( book, Book.All.class );
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
- assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
+ assertEquals( constraintViolation.getMessage(), "may not be null",
"Wrong message" );
assertEquals( constraintViolation.getRootBean(), book, "Wrong root entity"
);
assertEquals( constraintViolation.getInvalidValue(), book.getTitle(), "Wrong
value" );
- assertEquals( "title", constraintViolation.getPropertyPath(), "Wrong
propertyName" );
+ assertCorrectPropertyPaths(constraintViolations, "title");
book.setTitle( "Hibernate Persistence with JPA" );
book.setSubtitle( "Revised Edition of Hibernate in Action" );
@@ -305,7 +306,7 @@
);
for ( ConstraintViolation<User> constraintViolation : constraintViolations ) {
- if ( constraintViolation.getPropertyPath().equals( "defaultCreditCard" ) )
{
+ if ( constraintViolation.getPropertyPath().toString().equals(
"defaultCreditCard" ) ) {
TestUtil.assertConstraintViolation(
constraintViolation,
User.class,
@@ -313,7 +314,7 @@
"defaultCreditCard"
);
}
- else if ( constraintViolation.getPropertyPath().equals( "phoneNumber" ) ) {
+ else if ( constraintViolation.getPropertyPath().toString().equals(
"phoneNumber" ) ) {
TestUtil.assertConstraintViolation(
constraintViolation,
User.class,
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-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -40,6 +40,7 @@
import org.testng.annotations.Test;
import org.hibernate.jsr303.tck.util.TestUtil;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectPropertyPaths;
/**
* Tests for the implementation of <code>Validator</code>.
@@ -134,7 +135,7 @@
violation.getConstraintDescriptor().getAnnotation().annotationType(),
Pattern.class, "Wrong annotation type"
);
- assertEquals( violation.getPropertyPath(), "serialNumber", "Wrong
property path." );
+ assertCorrectPropertyPaths(constraintViolations, "serialNumber");
engine.setSerialNumber( "ABCD-EFGH-1234" );
constraintViolations = validator.validate( engine );
@@ -160,7 +161,7 @@
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
assertEquals( constraintViolation.getRootBean(), customer, "Wrong root
entity" );
assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(),
"Wrong value" );
- assertEquals( "orders[].orderNumber", constraintViolation.getPropertyPath(),
"Wrong propertyName" );
+ assertCorrectPropertyPaths(constraintViolations, "orders[].orderNumber");
}
@Test
@@ -186,9 +187,7 @@
assertEquals( "Everyone has a last name.", constraintViolation.getMessage(),
"Wrong message" );
org.testng.Assert.assertEquals( constraintViolation.getRootBean(), clint, "Wrong
root entity" );
org.testng.Assert.assertEquals( constraintViolation.getInvalidValue(),
morgan.getLastName(), "Wrong value" );
- assertEquals(
- constraintViolation.getPropertyPath(),
"playedWith[0].playedWith[1].lastName", "Wrong propertyName"
- );
+ assertCorrectPropertyPaths(constraintViolations,
"playedWith[0].playedWith[1].lastName");
}
@Test
@@ -213,6 +212,7 @@
assertEquals( "Everyone has a last name.", constraintViolation.getMessage(),
"Wrong message" );
org.testng.Assert.assertEquals( constraintViolation.getRootBean(), clint, "Wrong
root entity" );
org.testng.Assert.assertEquals( constraintViolation.getInvalidValue(),
morgan.getLastName(), "Wrong value" );
+
assertEquals(
constraintViolation.getPropertyPath(),
"playedWith[0].playedWith[1].lastName", "Wrong propertyName"
);
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidateValueTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -30,6 +30,7 @@
import org.testng.annotations.Test;
import org.hibernate.jsr303.tck.util.TestUtil;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectPropertyPaths;
/**
* Tests for the implementation of <code>Validator</code>.
@@ -147,11 +148,11 @@
ConstraintViolation constraintViolation = constraintViolations.iterator().next();
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints"
);
- assertEquals( "may not be null", constraintViolation.getMessage(),
"Wrong message" );
+ assertEquals( constraintViolation.getMessage(), "may not be null",
"Wrong message" );
assertEquals( constraintViolation.getRootBean(), null, "Wrong root entity"
);
assertEquals( constraintViolation.getRootBeanClass(), Customer.class, "Wrong root
bean class" );
assertEquals( constraintViolation.getInvalidValue(), null, "Wrong value" );
- assertEquals( "orders[0].orderNumber", constraintViolation.getPropertyPath(),
"Wrong propertyName" );
+ assertCorrectPropertyPaths( constraintViolations, "orders[0].orderNumber" );
constraintViolations = validator.validateValue( Customer.class,
"orders[0].orderNumber", 1234 );
assertEquals( constraintViolations.size(), 0, "Wrong number of constraints"
);
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-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/graphnavigation/GraphNavigationTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -74,11 +74,10 @@
Set<ConstraintViolation<Order>> constraintViolations = validator.validate(
order );
assertEquals( constraintViolations.size(), 3, "Wrong number of constraints"
);
assertCorrectPropertyPaths(
- constraintViolations, new String[] {
- "shippingAddress.addressline1",
- "customer.addresses[0].addressline1",
- "billingAddress.inhabitant.addresses[0].addressline1"
- }
+ constraintViolations,
+ "shippingAddress.addressline1",
+ "customer.addresses[0].addressline1",
+ "billingAddress.inhabitant.addresses[0].addressline1"
);
}
@@ -125,6 +124,6 @@
Validator validator = TestUtil.getDefaultValidator();
Set<ConstraintViolation<Parent>> errors = validator.validate( p,
ProperOrder.class );
assertEquals( 1, errors.size() );
- assertEquals( "child.name", errors.iterator().next().getPropertyPath() );
+ assertCorrectPropertyPaths( errors, "child.name" );
}
}
\ No newline at end of file
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.Set;
import javax.validation.TraversableResolver;
+import javax.validation.Path;
/**
* @author Emmanuel Bernard
@@ -65,6 +66,10 @@
return true;
}
+
+
+
+
public boolean isReachable(Object traversableObject, String traversableProperty,
Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
return isTraversable(
reachCalls,
@@ -89,6 +94,14 @@
);
}
+ public boolean isReachable(Object traversableObject, Path.Node traversableProperty,
Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+ return false; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
+ public boolean isCascadable(Object traversableObject, Path.Node traversableProperty,
Class<?> rootBeanType, Path pathToTraversableObject, ElementType elementType) {
+ return false; //To change body of implemented methods use File | Settings | File
Templates.
+ }
+
private static final class Call {
private Object traversableObject;
private String traversableProperty;
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/ConstraintValidatorContextTest.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/ConstraintValidatorContextTest.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/ConstraintValidatorContextTest.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -106,10 +106,10 @@
boolean validatedNestedBean = false;
for ( ConstraintViolation<DummyBean> violation : constraintViolations ) {
- if ( violation.getPropertyPath().equals( "value" ) ) {
+ if ( violation.getPropertyPath().toString().equals( "value" ) ) {
assertEquals( "dummy message", violation.getMessage(), "Wrong
message" );
}
- else if ( violation.getPropertyPath().equals( "nestedDummy.value" ) ) {
+ else if ( violation.getPropertyPath().toString().equals( "nestedDummy.value"
) ) {
assertEquals( "dummy message", violation.getMessage(), "Wrong
message" );
validatedNestedBean = true;
}
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java
===================================================================
---
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java 2009-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/validatorcontext/DummyValidator.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -41,7 +41,8 @@
if ( errorMessages != null ) {
for ( Map.Entry<String, String> entry : errorMessages.entrySet() ) {
- constraintValidatorContext.addError( entry.getKey(), entry.getValue() );
+ constraintValidatorContext.buildErrorWithMessageTemplate( entry.getKey() )
+ .inSubNode( entry.getValue() );
}
}
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-06-22
21:05:28 UTC (rev 16865)
+++
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java 2009-06-22
21:06:03 UTC (rev 16866)
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Set;
import javax.validation.ConstraintViolation;
+import javax.validation.Path;
import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.metadata.ConstraintDescriptor;
@@ -80,10 +81,10 @@
}
}
- public static <T> void
assertCorrectPropertyPaths(Set<ConstraintViolation<T>> violations, String[]
propertyPaths) {
+ public static <T> void
assertCorrectPropertyPaths(Set<ConstraintViolation<T>> violations, String...
propertyPaths) {
List<String> propertyPathsOfViolations = new ArrayList<String>();
for ( ConstraintViolation<?> violation : violations ) {
- propertyPathsOfViolations.add( violation.getPropertyPath() );
+ propertyPathsOfViolations.add( violation.getPropertyPath().toString() );
}
for ( String propertyPath : propertyPaths ) {
@@ -96,7 +97,7 @@
public static <T> void assertConstraintViolation(ConstraintViolation<T>
violation, Class<?> rootBean, Object invalidValue, String propertyPath) {
assertEquals(
- violation.getPropertyPath(),
+ violation.getPropertyPath().toString(),
propertyPath,
"Wrong propertyPath."
);