commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1209989 - in /commons/proper/digester/trunk/src: main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java test/java/org/apache/commons/digester3/Digester153TestCase.java
Date Sat, 03 Dec 2011 19:36:20 GMT
Author: simonetripodi
Date: Sat Dec  3 19:36:20 2011
New Revision: 1209989

URL: http://svn.apache.org/viewvc?rev=1209989&view=rev
Log:
re-enabled constructor test based on annotations

Modified:
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
    commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java?rev=1209989&r1=1209988&r2=1209989&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/annotations/FromAnnotationsRuleModule.java
Sat Dec  3 19:36:20 2011
@@ -186,13 +186,26 @@ public abstract class FromAnnotationsRul
                 handle( annotation, element );
             }
 
-            if ( element instanceof Method )
+            if ( element instanceof Constructor || element instanceof Method )
             {
-                // method args
-                Method method = (Method) element;
+                Annotation[][] parameterAnnotations;
+                Class<?>[] parameterTypes;
+
+                if ( element instanceof Constructor )
+                {
+                    // constructor args
+                    Constructor<?> construcotr = (Constructor<?>) element;
+                    parameterAnnotations = construcotr.getParameterAnnotations();
+                    parameterTypes = construcotr.getParameterTypes();
+                }
+                else
+                {
+                    // method args
+                    Method method = (Method) element;
+                    parameterAnnotations = method.getParameterAnnotations();
+                    parameterTypes = method.getParameterTypes();
+                }
 
-                Annotation[][] parameterAnnotations = method.getParameterAnnotations();
-                Class<?>[] parameterTypes = method.getParameterTypes();
                 for ( int i = 0; i < parameterTypes.length; i++ )
                 {
                     visitElements( new MethodArgument( i, parameterTypes[i], parameterAnnotations[i]
) );

Modified: commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java?rev=1209989&r1=1209988&r2=1209989&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
(original)
+++ commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester153TestCase.java
Sat Dec  3 19:36:20 2011
@@ -108,6 +108,7 @@ public final class Digester153TestCase
 
         } );
     }
+    */
 
     @Test
     public void basicConstructorViaAnnotations()
@@ -125,7 +126,7 @@ public final class Digester153TestCase
         } );
     }
 
-    @Test
+    /* @Test
     public void basicConstructorViaXML()
         throws Exception
     {
@@ -139,7 +140,7 @@ public final class Digester153TestCase
             }
 
         } );
-    }
+    } */
 
     private void succesfullConstructor( RulesModule rulesModule )
         throws Exception
@@ -152,7 +153,7 @@ public final class Digester153TestCase
         assertEquals( 9.99D, bean.getDoubleProperty(), 0 );
     }
 
-    @Test
+    /* @Test
     public void basicConstructorWithValuesNotFound()
         throws Exception
     {



Mime
View raw message