incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1032683 - /incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java
Date Mon, 08 Nov 2010 20:04:42 GMT
Author: mbenson
Date: Mon Nov  8 20:04:41 2010
New Revision: 1032683

URL: http://svn.apache.org/viewvc?rev=1032683&view=rev
Log:
add test to exhibit failure of cascading validation of a property path with no subordinate
validations

Modified:
    incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java?rev=1032683&r1=1032682&r2=1032683&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java
Mon Nov  8 20:04:41 2010
@@ -422,6 +422,25 @@ public class ValidationTest extends Test
         Assert.assertEquals(0, iv.size());
     }
 
+    public void testValidateCascadingNestedTipProperty() {
+        final String propPath = "addresses[0].country.name";
+        
+        CascadingPropertyValidator v = validator.unwrap(CascadingPropertyValidator.class);
+        Author author = new Author();
+        author.setAddresses(new ArrayList<Address>());
+        Address adr = new Address();
+        author.getAddresses().add(adr);
+        Country country = new Country();
+        adr.setCity("dark");
+        adr.setCountry(country);
+
+        Set<ConstraintViolation<Author>> iv = v.validateProperty(author, propPath);
+        Assert.assertEquals(1, iv.size());
+        
+        iv = v.validateProperty(author, propPath, true);
+        Assert.assertEquals(1, iv.size());
+    }
+
     public void testMetadataAPI() {
         BeanDescriptor bookBeanDescriptor = validator.getConstraintsForClass(Book.class);
 



Mime
View raw message