[richfaces-svn-commits] JBoss Rich Faces SVN: r18573 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Aug 11 17:15:41 EDT 2010


Author: lfryc at redhat.com
Date: 2010-08-11 17:15:41 -0400 (Wed, 11 Aug 2010)
New Revision: 18573

Modified:
   modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
Log:
MatrixConfigurator - satisfies injection from all fields for class (instead of declared files - it is limited to declaring class' fields)

Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java	2010-08-11 21:15:03 UTC (rev 18572)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java	2010-08-11 21:15:41 UTC (rev 18573)
@@ -283,11 +283,12 @@
         Object testInstance = getTestInstance(testClass);
         for (int i = 0; i < useAnnotation.value().length; i++) {
             boolean satisfied = false;
-            for (Field field : testClass.getDeclaredFields()) {
-                String name = useAnnotation.value()[i];
-                name = StringUtils.replace(name, "*", ".+");
-                name = StringUtils.replace(name, "?", ".");
-                Pattern pattern = Pattern.compile(name);
+            String namePattern = useAnnotation.value()[i];
+            namePattern = StringUtils.replace(namePattern, "*", ".+");
+            namePattern = StringUtils.replace(namePattern, "?", ".");
+            
+            for (Field field : getAllFields(testClass)) { 
+                Pattern pattern = Pattern.compile(namePattern);
                 if (pattern.matcher(field.getName()).matches()) {
                     boolean isArray = field.getType().isArray();
                     Class<?> representedType;
@@ -311,7 +312,7 @@
             if (satisfied) {
                 continue;
             }
-            throw new IllegalStateException("cannot find the field satysfying injection point");
+            throw new IllegalStateException("cannot find the field satysfying injection point with name pattern: " + useAnnotation.value()[i]);
         }
         return result;
     }



More information about the richfaces-svn-commits mailing list