incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1002881 - in /incubator/bval/sandbox/lang3-work/bval-jsr303d/src: main/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerImpl.java test/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerTest.java
Date Wed, 29 Sep 2010 22:37:52 GMT
Author: mbenson
Date: Wed Sep 29 22:37:51 2010
New Revision: 1002881

URL: http://svn.apache.org/viewvc?rev=1002881&view=rev
Log:
DynamicMetaGraphManager readOnly interface was not returning MetaProperty objects when it
should

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

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerImpl.java?rev=1002881&r1=1002880&r2=1002881&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerImpl.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerImpl.java
Wed Sep 29 22:37:51 2010
@@ -354,8 +354,8 @@ final class DynamicMetaGraphManagerImpl 
                         path.addNode(new NodeImpl(propertyName));
                         MetaBean metaBean = getMetaBean(prop.getTypeClass());
                         prop.setMetaBean(metaBean);
-                        result = prop;
                     }
+                    result = prop;
                 }
                 return (T) result;
             } finally {

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerTest.java?rev=1002881&r1=1002880&r2=1002881&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerTest.java
(original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303d/src/test/java/org/apache/bval/jsr303/dynamic/DynamicMetaGraphManagerTest.java
Wed Sep 29 22:37:51 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.bval.jsr303.dynamic;
 
+import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.*;
 
 import javax.validation.Validation;
@@ -27,6 +28,8 @@ import org.apache.bval.jsr303.dynamic.Dy
 import org.apache.bval.jsr303.dynamic.DynamicValidatorFactory;
 import org.apache.bval.jsr303.example.Book;
 import org.apache.bval.model.MetaBean;
+import org.apache.bval.model.MetaProperty;
+import org.hamcrest.CoreMatchers;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -60,22 +63,20 @@ public class DynamicMetaGraphManagerTest
 
     @Test
     public void testGetRootMeta() {
-        MetaBean metaBean = metaGraphManager.writable().getMeta(Book.class, "");
-        assertNotNull(metaBean);
-        metaBean = metaGraphManager.readOnly().getMeta(Book.class, "");
-        assertNotNull(metaBean);
+        assertThat(metaGraphManager.writable().getMeta(Book.class, ""), is(MetaBean.class));
+        assertThat(metaGraphManager.readOnly().getMeta(Book.class, ""), is(MetaBean.class));
     }
 
     @Test
     public void testGetImmediateProperty() {
-        assertNotNull(metaGraphManager.writable().getMeta(Book.class, "title"));
-        assertNotNull(metaGraphManager.readOnly().getMeta(Book.class, "title"));
+        assertThat(metaGraphManager.writable().getMeta(Book.class, "title"), is(MetaProperty.class));
+        assertThat(metaGraphManager.readOnly().getMeta(Book.class, "title"), is(MetaProperty.class));
     }
 
     @Test
     public void testGetNestedProperty() {
-        assertNotNull(metaGraphManager.writable().getMeta(Book.class, "author.addresses[].city"));
-        assertNotNull(metaGraphManager.readOnly().getMeta(Book.class, "author.addresses[].city"));
-        assertNotNull(metaGraphManager.readOnly().getMeta(Book.class, "author.addresses[0].city"));
+        assertThat(metaGraphManager.writable().getMeta(Book.class, "author.addresses[].city"),
is(MetaProperty.class));
+        assertThat(metaGraphManager.readOnly().getMeta(Book.class, "author.addresses[].city"),
is(MetaProperty.class));
+        assertThat(metaGraphManager.readOnly().getMeta(Book.class, "author.addresses[0].city"),
is(MetaProperty.class));
     }
 }



Mime
View raw message