incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1004677 - /incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicValidationTest.java
Date Tue, 05 Oct 2010 15:38:31 GMT
Author: mbenson
Date: Tue Oct  5 15:38:31 2010
New Revision: 1004677

URL: http://svn.apache.org/viewvc?rev=1004677&view=rev
Log:
more test coverage

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

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicValidationTest.java?rev=1004677&r1=1004676&r2=1004677&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicValidationTest.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicValidationTest.java
Tue Oct  5 15:38:31 2010
@@ -33,6 +33,7 @@ import javax.validation.metadata.Propert
 
 import junit.framework.Assert;
 
+import org.apache.bval.constraints.AuthorAddressKnown;
 import org.apache.bval.constraints.ZipCodeCityCoherence;
 import org.apache.bval.jsr303.ApacheValidationProvider;
 import org.apache.bval.jsr303.ApacheValidatorConfiguration;
@@ -158,7 +159,15 @@ public class DynamicValidationTest exten
         assertEquals(2, errors.size());
     }
 
-    public void testDynamicMetadata() {
+    public void testDynamicMetadataBean() {
+        BeanDescriptor authorDescriptor = validator.getConstraintsForClass(Author.class);
+        assertEquals(0, authorDescriptor.getConstraintDescriptors().size());
+        validatorContext.constrain(Author.class, AnnotationFactory.INSTANCE.create(AuthorAddressKnown.class));
+        authorDescriptor = validator.getConstraintsForClass(Author.class);
+        assertEquals(1, authorDescriptor.getConstraintDescriptors().size());
+    }
+
+    public void testDynamicMetadataProperty() {
         BeanDescriptor authorDescriptor = validator.getConstraintsForClass(Author.class);
         PropertyDescriptor propertyDescriptor = authorDescriptor.getConstraintsForProperty("addresses[0].addressline2");
         assertNotNull(propertyDescriptor);
@@ -199,7 +208,7 @@ public class DynamicValidationTest exten
 
     public void testClearDynamicConstraints() {
         // use this to setup:
-        testDynamicMetadata();
+        testDynamicMetadataProperty();
         validatorContext.clear();
         PropertyDescriptor propertyDescriptor =
             validator.getConstraintsForClass(Author.class).getConstraintsForProperty("addresses[0].addressline2");



Mime
View raw message