commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1103095 [19/24] - in /incubator/ognl/trunk/src: main/java/org/apache/commons/ognl/ main/java/org/apache/commons/ognl/enhance/ main/java/org/apache/commons/ognl/internal/ test/java/org/apache/commons/ognl/ test/java/org/apache/commons/ognl/...
Date Sat, 14 May 2011 13:18:36 GMT
Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CompilingPropertyAccessor.java Sat May 14 13:18:29 2011
@@ -38,76 +38,87 @@ import java.util.IdentityHashMap;
 import java.util.Map;
 
 /**
- * Implementation of PropertyAccessor that uses Javassist to compile a property accessor
- * specifically tailored to the property.
+ * Implementation of PropertyAccessor that uses Javassist to compile a property accessor specifically tailored to the
+ * property.
  */
-public class CompilingPropertyAccessor extends ObjectPropertyAccessor
+public class CompilingPropertyAccessor
+    extends ObjectPropertyAccessor
 {
 
-    private static NameFactory NAME_FACTORY = new NameFactory("ognl.PropertyAccessor", "v");
+    private static NameFactory NAME_FACTORY = new NameFactory( "ognl.PropertyAccessor", "v" );
+
     private static Getter NotFoundGetter = new Getter()
     {
 
-        public Object get(OgnlContext context, Object target, String propertyName)
+        public Object get( OgnlContext context, Object target, String propertyName )
         {
             return null;
         }
     };
+
     private static Getter DefaultGetter = new Getter()
     {
 
-        public Object get(OgnlContext context, Object target, String propertyName)
+        public Object get( OgnlContext context, Object target, String propertyName )
         {
-            try {
-                return OgnlRuntime.getMethodValue(context, target, propertyName, true);
-            } catch (Exception ex) {
-                throw new RuntimeException(ex);
+            try
+            {
+                return OgnlRuntime.getMethodValue( context, target, propertyName, true );
+            }
+            catch ( Exception ex )
+            {
+                throw new RuntimeException( ex );
             }
         }
     };
+
     private static Map pools = new HashMap();
+
     private static Map loaders = new HashMap();
 
     private static java.util.IdentityHashMap PRIMITIVE_WRAPPER_CLASSES = new IdentityHashMap();
+
     private java.util.IdentityHashMap seenGetMethods = new java.util.IdentityHashMap();
 
-    static {
-        PRIMITIVE_WRAPPER_CLASSES.put(Boolean.TYPE, Boolean.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Boolean.class, Boolean.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Byte.TYPE, Byte.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Byte.class, Byte.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Character.TYPE, Character.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Character.class, Character.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Short.TYPE, Short.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Short.class, Short.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Integer.TYPE, Integer.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Integer.class, Integer.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Long.TYPE, Long.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Long.class, Long.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Float.TYPE, Float.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Float.class, Float.TYPE);
-        PRIMITIVE_WRAPPER_CLASSES.put(Double.TYPE, Double.class);
-        PRIMITIVE_WRAPPER_CLASSES.put(Double.class, Double.TYPE);
+    static
+    {
+        PRIMITIVE_WRAPPER_CLASSES.put( Boolean.TYPE, Boolean.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Boolean.class, Boolean.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Byte.TYPE, Byte.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Byte.class, Byte.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Character.TYPE, Character.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Character.class, Character.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Short.TYPE, Short.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Short.class, Short.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Integer.TYPE, Integer.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Integer.class, Integer.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Long.TYPE, Long.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Long.class, Long.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Float.TYPE, Float.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Float.class, Float.TYPE );
+        PRIMITIVE_WRAPPER_CLASSES.put( Double.TYPE, Double.class );
+        PRIMITIVE_WRAPPER_CLASSES.put( Double.class, Double.TYPE );
     }
 
-    public static Class getPrimitiveWrapperClass(Class primitiveClass)
+    public static Class getPrimitiveWrapperClass( Class primitiveClass )
     {
-        return (Class) PRIMITIVE_WRAPPER_CLASSES.get(primitiveClass);
+        return (Class) PRIMITIVE_WRAPPER_CLASSES.get( primitiveClass );
     }
 
     public interface Getter
     {
-        public Object get(OgnlContext context, Object target, String propertyName);
+        public Object get( OgnlContext context, Object target, String propertyName );
     }
 
-    public static Getter generateGetter(OgnlContext context, String code)
+    public static Getter generateGetter( OgnlContext context, String code )
         throws OgnlException
     {
         String className = NAME_FACTORY.getNewClassName();
 
-        try {
-            ClassPool pool = (ClassPool) pools.get(context.getClassResolver());
-            EnhancedClassLoader loader = (EnhancedClassLoader) loaders.get(context.getClassResolver());
+        try
+        {
+            ClassPool pool = (ClassPool) pools.get( context.getClassResolver() );
+            EnhancedClassLoader loader = (EnhancedClassLoader) loaders.get( context.getClassResolver() );
             CtClass newClass;
             CtClass ognlContextClass;
             CtClass objectClass;
@@ -116,76 +127,117 @@ public class CompilingPropertyAccessor e
             byte[] byteCode;
             Class compiledClass;
 
-            if ((pool == null) || (loader == null)) {
-                ClassLoader classLoader = new ContextClassLoader(OgnlContext.class.getClassLoader(), context);
-                
+            if ( ( pool == null ) || ( loader == null ) )
+            {
+                ClassLoader classLoader = new ContextClassLoader( OgnlContext.class.getClassLoader(), context );
+
                 pool = ClassPool.getDefault();
-                pool.insertClassPath(new LoaderClassPath(classLoader));
-                pools.put(context.getClassResolver(), pool);
+                pool.insertClassPath( new LoaderClassPath( classLoader ) );
+                pools.put( context.getClassResolver(), pool );
 
-                loader = new EnhancedClassLoader(classLoader);
-                loaders.put(context.getClassResolver(), loader);
+                loader = new EnhancedClassLoader( classLoader );
+                loaders.put( context.getClassResolver(), loader );
             }
 
-            newClass = pool.makeClass(className);
-            ognlContextClass = pool.get(OgnlContext.class.getName());
-            objectClass = pool.get(Object.class.getName());
-            stringClass = pool.get(String.class.getName());
-
-            newClass.addInterface(pool.get(Getter.class.getName()));
-            method = new CtMethod(objectClass, "get", new CtClass[] { ognlContextClass, objectClass, stringClass },
-                    newClass);
-            method.setBody("{" + code + "}");
-            newClass.addMethod(method);
+            newClass = pool.makeClass( className );
+            ognlContextClass = pool.get( OgnlContext.class.getName() );
+            objectClass = pool.get( Object.class.getName() );
+            stringClass = pool.get( String.class.getName() );
+
+            newClass.addInterface( pool.get( Getter.class.getName() ) );
+            method =
+                new CtMethod( objectClass, "get", new CtClass[] { ognlContextClass, objectClass, stringClass },
+                              newClass );
+            method.setBody( "{" + code + "}" );
+            newClass.addMethod( method );
             byteCode = newClass.toBytecode();
-            compiledClass = loader.defineClass(className, byteCode);
+            compiledClass = loader.defineClass( className, byteCode );
             return (Getter) compiledClass.newInstance();
-        } catch (Throwable ex) {
-            throw new OgnlException("Cannot create class", ex);
+        }
+        catch ( Throwable ex )
+        {
+            throw new OgnlException( "Cannot create class", ex );
         }
     }
 
-    private Getter getGetter(OgnlContext context, Object target, String propertyName)
+    private Getter getGetter( OgnlContext context, Object target, String propertyName )
         throws OgnlException
     {
         Getter result;
         Class targetClass = target.getClass();
         Map propertyMap;
 
-        if ((propertyMap = (Map) seenGetMethods.get(targetClass)) == null) {
-            propertyMap = new HashMap(101);
-            seenGetMethods.put(targetClass, propertyMap);
-        }
-        if ((result = (Getter) propertyMap.get(propertyName)) == null) {
-            try {
-                Method method = OgnlRuntime.getGetMethod(context, targetClass, propertyName);
-
-                if (method != null) {
-                    if (Modifier.isPublic(method.getModifiers())) {
-                        if (method.getReturnType().isPrimitive()) {
-                            propertyMap.put(propertyName, result = generateGetter(context,
-                                    "java.lang.Object\t\tresult;\n" + targetClass.getName() + "\t" + "t0 = ("
-                                            + targetClass.getName() + ")$2;\n" + "\n" + "try {\n" + "   result = new "
-                                            + getPrimitiveWrapperClass(method.getReturnType()).getName() + "(t0."
-                                            + method.getName() + "());\n" + "} catch (java.lang.Exception ex) {\n"
-                                            + "    throw new java.lang.RuntimeException(ex);\n" + "}\n"
-                                            + "return result;"));
-                        } else {
-                            propertyMap.put(propertyName, result = generateGetter(context,
-                                    "java.lang.Object\t\tresult;\n" + targetClass.getName() + "\t" + "t0 = ("
-                                            + targetClass.getName() + ")$2;\n" + "\n" + "try {\n" + "   result = t0."
-                                            + method.getName() + "();\n" + "} catch (java.lang.Exception ex) {\n"
-                                            + "    throw new java.lang.RuntimeException(ex);\n" + "}\n"
-                                            + "return result;"));
+        if ( ( propertyMap = (Map) seenGetMethods.get( targetClass ) ) == null )
+        {
+            propertyMap = new HashMap( 101 );
+            seenGetMethods.put( targetClass, propertyMap );
+        }
+        if ( ( result = (Getter) propertyMap.get( propertyName ) ) == null )
+        {
+            try
+            {
+                Method method = OgnlRuntime.getGetMethod( context, targetClass, propertyName );
+
+                if ( method != null )
+                {
+                    if ( Modifier.isPublic( method.getModifiers() ) )
+                    {
+                        if ( method.getReturnType().isPrimitive() )
+                        {
+                            propertyMap.put( propertyName,
+                                             result =
+                                                 generateGetter( context,
+                                                                 "java.lang.Object\t\tresult;\n"
+                                                                     + targetClass.getName()
+                                                                     + "\t"
+                                                                     + "t0 = ("
+                                                                     + targetClass.getName()
+                                                                     + ")$2;\n"
+                                                                     + "\n"
+                                                                     + "try {\n"
+                                                                     + "   result = new "
+                                                                     + getPrimitiveWrapperClass( method.getReturnType() ).getName()
+                                                                     + "(t0."
+                                                                     + method.getName()
+                                                                     + "());\n"
+                                                                     + "} catch (java.lang.Exception ex) {\n"
+                                                                     + "    throw new java.lang.RuntimeException(ex);\n"
+                                                                     + "}\n" + "return result;" ) );
+                        }
+                        else
+                        {
+                            propertyMap.put( propertyName,
+                                             result =
+                                                 generateGetter( context,
+                                                                 "java.lang.Object\t\tresult;\n"
+                                                                     + targetClass.getName()
+                                                                     + "\t"
+                                                                     + "t0 = ("
+                                                                     + targetClass.getName()
+                                                                     + ")$2;\n"
+                                                                     + "\n"
+                                                                     + "try {\n"
+                                                                     + "   result = t0."
+                                                                     + method.getName()
+                                                                     + "();\n"
+                                                                     + "} catch (java.lang.Exception ex) {\n"
+                                                                     + "    throw new java.lang.RuntimeException(ex);\n"
+                                                                     + "}\n" + "return result;" ) );
                         }
-                    } else {
-                        propertyMap.put(propertyName, result = DefaultGetter);
                     }
-                } else {
-                    propertyMap.put(propertyName, result = NotFoundGetter);
+                    else
+                    {
+                        propertyMap.put( propertyName, result = DefaultGetter );
+                    }
+                }
+                else
+                {
+                    propertyMap.put( propertyName, result = NotFoundGetter );
                 }
-            } catch (Exception ex) {
-                throw new OgnlException("getting getter", ex);
+            }
+            catch ( Exception ex )
+            {
+                throw new OgnlException( "getting getter", ex );
             }
         }
         return result;
@@ -194,26 +246,35 @@ public class CompilingPropertyAccessor e
     /**
      * Returns OgnlRuntime.NotFound if the property does not exist.
      */
-    public Object getPossibleProperty(Map context, Object target, String name)
+    public Object getPossibleProperty( Map context, Object target, String name )
         throws OgnlException
     {
         Object result;
         OgnlContext ognlContext = (OgnlContext) context;
 
-        if (context.get("_compile") != null) {
-            Getter getter = getGetter(ognlContext, target, name);
+        if ( context.get( "_compile" ) != null )
+        {
+            Getter getter = getGetter( ognlContext, target, name );
 
-            if (getter != NotFoundGetter) {
-                result = getter.get(ognlContext, target, name);
-            } else {
-                try {
-                    result = OgnlRuntime.getFieldValue(ognlContext, target, name, true);
-                } catch (Exception ex) {
-                    throw new OgnlException(name, ex);
+            if ( getter != NotFoundGetter )
+            {
+                result = getter.get( ognlContext, target, name );
+            }
+            else
+            {
+                try
+                {
+                    result = OgnlRuntime.getFieldValue( ognlContext, target, name, true );
+                }
+                catch ( Exception ex )
+                {
+                    throw new OgnlException( name, ex );
                 }
             }
-        } else {
-            result = super.getPossibleProperty(context, target, name);
+        }
+        else
+        {
+            result = super.getPossibleProperty( context, target, name );
         }
         return result;
     }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTest.java Sat May 14 13:18:29 2011
@@ -24,39 +24,39 @@ import org.apache.commons.ognl.Expressio
 
 import java.util.Arrays;
 
-public class ConstantTest extends OgnlTestCase
+public class ConstantTest
+    extends OgnlTestCase
 {
 
     private static Object[][] TESTS = {
-            { "12345", new Integer(12345) },
-            { "0x100", new Integer(256) },
-            { "0xfE", new Integer(254) },
-            { "01000", new Integer(512) },
-            { "1234L", new Integer(1234) },
-            { "12.34", new Double(12.34) },
-            { ".1234", new Double(.12340000000000) },
-            { "12.34f", Double.valueOf(12.34) },
-            { "12.", new Double(12) },
-            { "12e+1d", new Double(120) },
-            { "'x'", new Character('x') },
-            { "'\\n'", new Character('\n') },
-            { "'\\u048c'", new Character('\u048c')},
-            { "'\\47'", new Character('\47') },
-            { "'\\367'", new Character('\367') },
-            { "'\\367", ExpressionSyntaxException.class },
-            { "'\\x'", ExpressionSyntaxException.class },
-            { "\"hello world\"", "hello world" },
-            { "\"\\u00a0\\u0068ell\\'o\\\\\\n\\r\\f\\t\\b\\\"\\167orld\\\"\"", "\u00a0hell'o\\\n\r\f\t\b\"world\"" },
-            { "\"hello world", ExpressionSyntaxException.class },
-            { "\"hello\\x world\"", ExpressionSyntaxException.class },
-            { "null", null },
-            { "true", Boolean.TRUE },
-            { "false", Boolean.FALSE },
-            { "{ false, true, null, 0, 1. }",
-              Arrays.asList(new Object[] { Boolean.FALSE, Boolean.TRUE, null, new Integer(0), new Double(1) }) },
-            { "'HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"'",
-              "HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"" },
-    };
+        { "12345", new Integer( 12345 ) },
+        { "0x100", new Integer( 256 ) },
+        { "0xfE", new Integer( 254 ) },
+        { "01000", new Integer( 512 ) },
+        { "1234L", new Integer( 1234 ) },
+        { "12.34", new Double( 12.34 ) },
+        { ".1234", new Double( .12340000000000 ) },
+        { "12.34f", Double.valueOf( 12.34 ) },
+        { "12.", new Double( 12 ) },
+        { "12e+1d", new Double( 120 ) },
+        { "'x'", new Character( 'x' ) },
+        { "'\\n'", new Character( '\n' ) },
+        { "'\\u048c'", new Character( '\u048c' ) },
+        { "'\\47'", new Character( '\47' ) },
+        { "'\\367'", new Character( '\367' ) },
+        { "'\\367", ExpressionSyntaxException.class },
+        { "'\\x'", ExpressionSyntaxException.class },
+        { "\"hello world\"", "hello world" },
+        { "\"\\u00a0\\u0068ell\\'o\\\\\\n\\r\\f\\t\\b\\\"\\167orld\\\"\"", "\u00a0hell'o\\\n\r\f\t\b\"world\"" },
+        { "\"hello world", ExpressionSyntaxException.class },
+        { "\"hello\\x world\"", ExpressionSyntaxException.class },
+        { "null", null },
+        { "true", Boolean.TRUE },
+        { "false", Boolean.FALSE },
+        { "{ false, true, null, 0, 1. }",
+            Arrays.asList( new Object[] { Boolean.FALSE, Boolean.TRUE, null, new Integer( 0 ), new Double( 1 ) } ) },
+        { "'HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"'",
+            "HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"" }, };
 
     /*
      * =================================================================== Public static methods
@@ -66,9 +66,10 @@ public class ConstantTest extends OgnlTe
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            result.addTest(new ConstantTest((String) TESTS[i][0] + " (" + TESTS[i][1] + ")", null,
-                                            (String) TESTS[i][0], TESTS[i][1]));
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            result.addTest( new ConstantTest( (String) TESTS[i][0] + " (" + TESTS[i][1] + ")", null,
+                                              (String) TESTS[i][0], TESTS[i][1] ) );
         }
         return result;
     }
@@ -82,24 +83,24 @@ public class ConstantTest extends OgnlTe
         super();
     }
 
-    public ConstantTest(String name)
+    public ConstantTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ConstantTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                        Object expectedAfterSetResult)
+    public ConstantTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                         Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public ConstantTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public ConstantTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ConstantTest(String name, Object root, String expressionString, Object expectedResult)
+    public ConstantTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ConstantTreeTest.java Sat May 14 13:18:29 2011
@@ -22,27 +22,22 @@ package org.apache.commons.ognl.test;
 import junit.framework.TestSuite;
 import org.apache.commons.ognl.Ognl;
 
-public class ConstantTreeTest extends OgnlTestCase
+public class ConstantTreeTest
+    extends OgnlTestCase
 {
 
     public static int nonFinalStaticVariable = 15;
 
-    private static Object[][] TESTS = { 
-        { "true", Boolean.TRUE }, 
-        { "55", Boolean.TRUE }, 
-        { "@java.awt.Color@black", Boolean.TRUE }, 
+    private static Object[][] TESTS = { { "true", Boolean.TRUE }, { "55", Boolean.TRUE },
+        { "@java.awt.Color@black", Boolean.TRUE },
         { "@org.apache.commons.ognl.test.ConstantTreeTest@nonFinalStaticVariable", Boolean.FALSE },
         { "@org.apache.commons.ognl.test.ConstantTreeTest@nonFinalStaticVariable + 10", Boolean.FALSE },
-        { "55 + 24 + @java.awt.Event@ALT_MASK", Boolean.TRUE },
-        { "name", Boolean.FALSE },
-        { "name[i]", Boolean.FALSE },
-        { "name[i].property", Boolean.FALSE }, 
-        { "name.{? foo }", Boolean.FALSE },
-        { "name.{ foo }", Boolean.FALSE }, 
-        { "name.{ 25 }", Boolean.FALSE }
-        
+        { "55 + 24 + @java.awt.Event@ALT_MASK", Boolean.TRUE }, { "name", Boolean.FALSE },
+        { "name[i]", Boolean.FALSE }, { "name[i].property", Boolean.FALSE }, { "name.{? foo }", Boolean.FALSE },
+        { "name.{ foo }", Boolean.FALSE }, { "name.{ 25 }", Boolean.FALSE }
+
     };
-    
+
     /*
      * =================================================================== Public static methods
      * ===================================================================
@@ -51,9 +46,10 @@ public class ConstantTreeTest extends Og
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            result.addTest(new ConstantTreeTest((String) TESTS[i][0] + " (" + TESTS[i][1] + ")", null,
-                    (String) TESTS[i][0], TESTS[i][1]));
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            result.addTest( new ConstantTreeTest( (String) TESTS[i][0] + " (" + TESTS[i][1] + ")", null,
+                                                  (String) TESTS[i][0], TESTS[i][1] ) );
         }
         return result;
     }
@@ -65,7 +61,7 @@ public class ConstantTreeTest extends Og
     protected void runTest()
         throws Exception
     {
-        assertTrue(Ognl.isConstant(getExpression(), _context) == ((Boolean) getExpectedResult()).booleanValue());
+        assertTrue( Ognl.isConstant( getExpression(), _context ) == ( (Boolean) getExpectedResult() ).booleanValue() );
     }
 
     /*
@@ -77,24 +73,24 @@ public class ConstantTreeTest extends Og
         super();
     }
 
-    public ConstantTreeTest(String name)
+    public ConstantTreeTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ConstantTreeTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-            Object expectedAfterSetResult)
+    public ConstantTreeTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                             Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public ConstantTreeTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public ConstantTreeTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ConstantTreeTest(String name, Object root, String expressionString, Object expectedResult)
+    public ConstantTreeTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ContextVariableTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ContextVariableTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ContextVariableTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ContextVariableTest.java Sat May 14 13:18:29 2011
@@ -22,16 +22,17 @@ package org.apache.commons.ognl.test;
 import junit.framework.TestSuite;
 import org.apache.commons.ognl.test.objects.Simple;
 
-public class ContextVariableTest extends OgnlTestCase {
+public class ContextVariableTest
+    extends OgnlTestCase
+{
 
     private static Object ROOT = new Simple();
+
     private static Object[][] TESTS = {
-            // Naming and referring to names
-            {"#root", ROOT}, // Special root reference
-            {"#this", ROOT}, // Special this reference
-            {"#f=5, #s=6, #f + #s", new Integer(11)},
-            { "#six=(#five=5, 6), #five + #six", new Integer(11)},
-    };
+        // Naming and referring to names
+        { "#root", ROOT }, // Special root reference
+        { "#this", ROOT }, // Special this reference
+        { "#f=5, #s=6, #f + #s", new Integer( 11 ) }, { "#six=(#five=5, 6), #five + #six", new Integer( 11 ) }, };
 
     /*
      * =================================================================== Public static methods
@@ -41,9 +42,10 @@ public class ContextVariableTest extends
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            result.addTest(new ContextVariableTest((String) TESTS[i][0] + " (" + TESTS[i][1] + ")", ROOT,
-                    (String) TESTS[i][0], TESTS[i][1]));
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            result.addTest( new ContextVariableTest( (String) TESTS[i][0] + " (" + TESTS[i][1] + ")", ROOT,
+                                                     (String) TESTS[i][0], TESTS[i][1] ) );
         }
         return result;
     }
@@ -57,24 +59,25 @@ public class ContextVariableTest extends
         super();
     }
 
-    public ContextVariableTest(String name)
+    public ContextVariableTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ContextVariableTest(String name, Object root, String expressionString, Object expectedResult,
-                               Object setValue, Object expectedAfterSetResult)
+    public ContextVariableTest( String name, Object root, String expressionString, Object expectedResult,
+                                Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public ContextVariableTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public ContextVariableTest( String name, Object root, String expressionString, Object expectedResult,
+                                Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ContextVariableTest(String name, Object root, String expressionString, Object expectedResult)
+    public ContextVariableTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CorrectedObjectNullHandler.java Sat May 14 13:18:29 2011
@@ -23,35 +23,41 @@ import org.apache.commons.ognl.NullHandl
 
 import java.util.Map;
 
-public class CorrectedObjectNullHandler extends Object implements NullHandler
+public class CorrectedObjectNullHandler
+    extends Object
+    implements NullHandler
 {
-    private String          defaultValue;
+    private String defaultValue;
 
-    /*===================================================================
-        Constructors
-      ===================================================================*/
-    public CorrectedObjectNullHandler(String defaultValue)
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
+    public CorrectedObjectNullHandler( String defaultValue )
     {
         super();
         this.defaultValue = defaultValue;
     }
 
-    /*===================================================================
-        TypeConverter interface (overridden)
-      ===================================================================*/
-    public Object nullMethodResult(Map context, Object target, String methodName, Object[] args)
+    /*
+     * =================================================================== TypeConverter interface (overridden)
+     * ===================================================================
+     */
+    public Object nullMethodResult( Map context, Object target, String methodName, Object[] args )
     {
-        if (methodName.equals("getStringValue")) {
+        if ( methodName.equals( "getStringValue" ) )
+        {
             return defaultValue;
         }
         return null;
     }
 
-    public Object nullPropertyValue(Map context, Object target, Object property)
+    public Object nullPropertyValue( Map context, Object target, Object property )
     {
-        Object      result = null;
+        Object result = null;
 
-        if (property.equals("stringValue")) {
+        if ( property.equals( "stringValue" ) )
+        {
             return defaultValue;
         }
         return null;

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/GenericsTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/GenericsTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/GenericsTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/GenericsTest.java Sat May 14 13:18:29 2011
@@ -28,36 +28,38 @@ import org.apache.commons.ognl.test.obje
 /**
  * Tests java >= 1.5 generics support in ognl.
  */
-public class GenericsTest extends OgnlTestCase
+public class GenericsTest
+    extends OgnlTestCase
 {
     static GenericRoot ROOT = new GenericRoot();
+
     static BaseGeneric<GameGenericObject, Long> GENERIC = new GameGeneric();
 
     static Object[][] TESTS = {
-            /* { ROOT, "cracker.param", null, new Integer(2), new Integer(2)}, */
-            { GENERIC, "ids", null, new Long[] {1l, 101l}, new Long[] {1l, 101l}},
-            /* { GENERIC, "ids", new Long[] {1l, 101l}, new String[] {"2", "34"}, new Long[]{2l, 34l}}, */
+    /* { ROOT, "cracker.param", null, new Integer(2), new Integer(2)}, */
+    { GENERIC, "ids", null, new Long[] { 1l, 101l }, new Long[] { 1l, 101l } },
+    /* { GENERIC, "ids", new Long[] {1l, 101l}, new String[] {"2", "34"}, new Long[]{2l, 34l}}, */
     };
 
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++)
+        for ( int i = 0; i < TESTS.length; i++ )
         {
-            if (TESTS[i].length == 5)
+            if ( TESTS[i].length == 5 )
             {
-                result.addTest(new GenericsTest((String) TESTS[i][1] + " (" + TESTS[i][2] + ")", TESTS[i][0], (String) TESTS[i][1],
-                                                TESTS[i][2], TESTS[i][3], TESTS[i][4]));
+                result.addTest( new GenericsTest( (String) TESTS[i][1] + " (" + TESTS[i][2] + ")", TESTS[i][0],
+                                                  (String) TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4] ) );
             }
         }
 
         return result;
     }
 
-    public GenericsTest(String name, Object root, String expressionString,
-                        Object expectedResult, Object setValue, Object expectedAfterSetResult)
+    public GenericsTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                         Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexAccessTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexAccessTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexAccessTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexAccessTest.java Sat May 14 13:18:29 2011
@@ -25,31 +25,33 @@ import org.apache.commons.ognl.NoSuchPro
 import org.apache.commons.ognl.test.objects.IndexedSetObject;
 import org.apache.commons.ognl.test.objects.Root;
 
-public class IndexAccessTest extends OgnlTestCase {
+public class IndexAccessTest
+    extends OgnlTestCase
+{
 
     private static Root ROOT = new Root();
+
     private static IndexedSetObject INDEXED_SET = new IndexedSetObject();
 
-    private static Object[][] TESTS = {
-            {ROOT, "list[index]", ROOT.getList().get(ROOT.getIndex())},
-            {ROOT, "list[objectIndex]", ROOT.getList().get(ROOT.getObjectIndex().intValue())},
-            {ROOT, "array[objectIndex]", ROOT.getArray()[ROOT.getObjectIndex().intValue()] },
-            {ROOT, "array[getObjectIndex()]", ROOT.getArray()[ROOT.getObjectIndex().intValue()] },
-            {ROOT, "array[genericIndex]", ROOT.getArray()[((Integer)ROOT.getGenericIndex()).intValue()] },
-            {ROOT, "booleanArray[self.objectIndex]", Boolean.FALSE },
-            {ROOT, "booleanArray[getObjectIndex()]", Boolean.FALSE },
-            {ROOT, "booleanArray[nullIndex]", NoSuchPropertyException.class},
-            {ROOT, "list[size() - 1]", MethodFailedException.class},
-            {ROOT, "(index == (array.length - 3)) ? 'toggle toggleSelected' : 'toggle'", "toggle toggleSelected"},
-            {ROOT, "\"return toggleDisplay('excdisplay\"+index+\"', this)\"", "return toggleDisplay('excdisplay1', this)"},
-            {ROOT, "map[mapKey].split('=')[0]", "StringStuff"},
-            {ROOT, "booleanValues[index1][index2]", Boolean.FALSE},
-            {ROOT, "tab.searchCriteria[index1].displayName", "Woodland creatures"},
-            {ROOT, "tab.searchCriteriaSelections[index1][index2]", Boolean.TRUE},
-            {ROOT, "tab.searchCriteriaSelections[index1][index2]", Boolean.TRUE, Boolean.FALSE, Boolean.FALSE},
-            {ROOT, "map['bar'].value", 100, 50, 50},
-            {INDEXED_SET, "thing[\"x\"].val", 1, 2, 2}
-    };
+    private static Object[][] TESTS =
+        {
+            { ROOT, "list[index]", ROOT.getList().get( ROOT.getIndex() ) },
+            { ROOT, "list[objectIndex]", ROOT.getList().get( ROOT.getObjectIndex().intValue() ) },
+            { ROOT, "array[objectIndex]", ROOT.getArray()[ROOT.getObjectIndex().intValue()] },
+            { ROOT, "array[getObjectIndex()]", ROOT.getArray()[ROOT.getObjectIndex().intValue()] },
+            { ROOT, "array[genericIndex]", ROOT.getArray()[( (Integer) ROOT.getGenericIndex() ).intValue()] },
+            { ROOT, "booleanArray[self.objectIndex]", Boolean.FALSE },
+            { ROOT, "booleanArray[getObjectIndex()]", Boolean.FALSE },
+            { ROOT, "booleanArray[nullIndex]", NoSuchPropertyException.class },
+            { ROOT, "list[size() - 1]", MethodFailedException.class },
+            { ROOT, "(index == (array.length - 3)) ? 'toggle toggleSelected' : 'toggle'", "toggle toggleSelected" },
+            { ROOT, "\"return toggleDisplay('excdisplay\"+index+\"', this)\"",
+                "return toggleDisplay('excdisplay1', this)" }, { ROOT, "map[mapKey].split('=')[0]", "StringStuff" },
+            { ROOT, "booleanValues[index1][index2]", Boolean.FALSE },
+            { ROOT, "tab.searchCriteria[index1].displayName", "Woodland creatures" },
+            { ROOT, "tab.searchCriteriaSelections[index1][index2]", Boolean.TRUE },
+            { ROOT, "tab.searchCriteriaSelections[index1][index2]", Boolean.TRUE, Boolean.FALSE, Boolean.FALSE },
+            { ROOT, "map['bar'].value", 100, 50, 50 }, { INDEXED_SET, "thing[\"x\"].val", 1, 2, 2 } };
 
     /*
      * =================================================================== Public static methods
@@ -59,48 +61,50 @@ public class IndexAccessTest extends Ogn
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++)
+        for ( int i = 0; i < TESTS.length; i++ )
         {
-            if (TESTS[i].length == 5)
+            if ( TESTS[i].length == 5 )
             {
-                result.addTest(new IndexAccessTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2],
-                                                   TESTS[i][3], TESTS[i][4]));
-            } else
+                result.addTest( new IndexAccessTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                     TESTS[i][2], TESTS[i][3], TESTS[i][4] ) );
+            }
+            else
             {
-                result.addTest(new IndexAccessTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2]));
+                result.addTest( new IndexAccessTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                     TESTS[i][2] ) );
             }
         }
         return result;
     }
 
     /*
-    * =================================================================== Constructors
-    * ===================================================================
-    */
+     * =================================================================== Constructors
+     * ===================================================================
+     */
     public IndexAccessTest()
     {
         super();
     }
 
-    public IndexAccessTest(String name)
+    public IndexAccessTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public IndexAccessTest(String name, Object root, String expressionString, Object expectedResult,
-                           Object setValue, Object expectedAfterSetResult)
+    public IndexAccessTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                            Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public IndexAccessTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public IndexAccessTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public IndexAccessTest(String name, Object root, String expressionString, Object expectedResult)
+    public IndexAccessTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     public void setUp()

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexedPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexedPropertyTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexedPropertyTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/IndexedPropertyTest.java Sat May 14 13:18:29 2011
@@ -23,53 +23,64 @@ import junit.framework.TestSuite;
 import org.apache.commons.ognl.test.objects.Indexed;
 import org.apache.commons.ognl.test.objects.Root;
 
-public class IndexedPropertyTest extends OgnlTestCase {
+public class IndexedPropertyTest
+    extends OgnlTestCase
+{
 
     private static Indexed INDEXED = new Indexed();
+
     private static Root ROOT = new Root();
 
     private static Object[][] TESTS = {
-            // Indexed properties
-            {INDEXED, "getValues", INDEXED.getValues()}, // gets String[]
-            {INDEXED, "[\"values\"]", INDEXED.getValues()}, // String[]
-            {INDEXED.getValues(), "[0]", INDEXED.getValues()[0]}, // "foo"
-            {INDEXED, "getValues()[0]", INDEXED.getValues()[0]}, // "foo" directly from array
-            {INDEXED, "values[0]", INDEXED.getValues(0)}, // "foo" + "xxx"
-            {INDEXED, "values[^]", INDEXED.getValues(0)}, // "foo" + "xxx"
-            {INDEXED, "values[|]", INDEXED.getValues(1)}, // "bar" + "xxx"
-            {INDEXED, "values[$]", INDEXED.getValues(2)}, // "baz" + "xxx"
-            {INDEXED, "values[1]", "bar" + "xxx", "xxxx" + "xxx", "xxxx" + "xxx"}, // set through setValues(int, String)
-            {INDEXED, "values[1]", "xxxx" + "xxx"}, // getValues(int) again to check if setValues(int, String) was called
-            {INDEXED, "setValues(2, \"xxxx\")", null}, // was "baz" -> "xxxx"
-            {INDEXED, "getTitle(list.size)", "Title count 3"},
-            {INDEXED, "source.total", 1},
-            {ROOT, "indexer.line[index]", "line:1"},
-            {INDEXED, "list[2].longValue()", (long) 3},
-            {ROOT, "map.value.id", (long) 1},
-            {INDEXED, "property['hoodak']", null, "random string", "random string"}
-    };
+        // Indexed properties
+        { INDEXED, "getValues", INDEXED.getValues() }, // gets String[]
+        { INDEXED, "[\"values\"]", INDEXED.getValues() }, // String[]
+        { INDEXED.getValues(), "[0]", INDEXED.getValues()[0] }, // "foo"
+        { INDEXED, "getValues()[0]", INDEXED.getValues()[0] }, // "foo" directly from array
+        { INDEXED, "values[0]", INDEXED.getValues( 0 ) }, // "foo" + "xxx"
+        { INDEXED, "values[^]", INDEXED.getValues( 0 ) }, // "foo" + "xxx"
+        { INDEXED, "values[|]", INDEXED.getValues( 1 ) }, // "bar" + "xxx"
+        { INDEXED, "values[$]", INDEXED.getValues( 2 ) }, // "baz" + "xxx"
+        { INDEXED, "values[1]", "bar" + "xxx", "xxxx" + "xxx", "xxxx" + "xxx" }, // set through setValues(int, String)
+        { INDEXED, "values[1]", "xxxx" + "xxx" }, // getValues(int) again to check if setValues(int, String) was called
+        { INDEXED, "setValues(2, \"xxxx\")", null }, // was "baz" -> "xxxx"
+        { INDEXED, "getTitle(list.size)", "Title count 3" }, { INDEXED, "source.total", 1 },
+        { ROOT, "indexer.line[index]", "line:1" }, { INDEXED, "list[2].longValue()", (long) 3 },
+        { ROOT, "map.value.id", (long) 1 }, { INDEXED, "property['hoodak']", null, "random string", "random string" } };
 
     /*
      * =================================================================== Public static methods
      * ===================================================================
      */
-    public static TestSuite suite() {
+    public static TestSuite suite()
+    {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new IndexedPropertyTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                        TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new IndexedPropertyTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                            TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new IndexedPropertyTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new IndexedPropertyTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                         TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new IndexedPropertyTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                             TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new IndexedPropertyTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                 (String) TESTS[i][1], TESTS[i][2], TESTS[i][3],
+                                                                 TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -81,16 +92,20 @@ public class IndexedPropertyTest extends
      * =================================================================== Constructors
      * ===================================================================
      */
-    public IndexedPropertyTest(String name, Object root, String expressionString, Object expectedResult,
-                               Object setValue, Object expectedAfterSetResult) {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+    public IndexedPropertyTest( String name, Object root, String expressionString, Object expectedResult,
+                                Object setValue, Object expectedAfterSetResult )
+    {
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public IndexedPropertyTest(String name, Object root, String expressionString, Object expectedResult, Object setValue) {
-        super(name, root, expressionString, expectedResult, setValue);
+    public IndexedPropertyTest( String name, Object root, String expressionString, Object expectedResult,
+                                Object setValue )
+    {
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public IndexedPropertyTest(String name, Object root, String expressionString, Object expectedResult) {
-        super(name, root, expressionString, expectedResult);
+    public IndexedPropertyTest( String name, Object root, String expressionString, Object expectedResult )
+    {
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InheritedMethodsTest.java Sat May 14 13:18:29 2011
@@ -31,32 +31,31 @@ import org.apache.commons.ognl.test.obje
 import org.apache.commons.ognl.test.objects.Root;
 import org.apache.commons.ognl.test.objects.SecondBean;
 
-
 /**
  * Tests functionality of casting inherited method expressions.
- * 
  */
-public class InheritedMethodsTest extends TestCase
+public class InheritedMethodsTest
+    extends TestCase
 {
-    
+
     private static Root ROOT = new Root();
-    
+
     public void test_Base_Inheritance()
-    throws Exception
+        throws Exception
     {
-        OgnlContext context = (OgnlContext)Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
         String expression = "map.bean.name";
         BaseBean first = new FirstBean();
         BaseBean second = new SecondBean();
-        
-        ROOT.getMap().put("bean", first);
-        
-        Node node = Ognl.compileExpression(context, ROOT, expression);
-        
-        assertEquals(first.getName(), node.getAccessor().get(context, ROOT));
-        
-        ROOT.getMap().put("bean", second);
-        
-        assertEquals(second.getName(), node.getAccessor().get(context, ROOT));
+
+        ROOT.getMap().put( "bean", first );
+
+        Node node = Ognl.compileExpression( context, ROOT, expression );
+
+        assertEquals( first.getName(), node.getAccessor().get( context, ROOT ) );
+
+        ROOT.getMap().put( "bean", second );
+
+        assertEquals( second.getName(), node.getAccessor().get( context, ROOT ) );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InterfaceInheritanceTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InterfaceInheritanceTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InterfaceInheritanceTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/InterfaceInheritanceTest.java Sat May 14 13:18:29 2011
@@ -30,44 +30,36 @@ import org.apache.commons.ognl.test.obje
 
 import java.util.List;
 
-public class InterfaceInheritanceTest extends OgnlTestCase {
+public class InterfaceInheritanceTest
+    extends OgnlTestCase
+{
 
     private static Root ROOT = new Root();
 
-    static {
-        ROOT.getBeans().setBean("testBean", new Bean1());
-        ROOT.getBeans().setBean("evenOdd", new EvenOdd());
+    static
+    {
+        ROOT.getBeans().setBean( "testBean", new Bean1() );
+        ROOT.getBeans().setBean( "evenOdd", new EvenOdd() );
 
         List list = new ListSourceImpl();
-        list.add("test1");
+        list.add( "test1" );
 
-        ROOT.getMap().put("customList", list);
+        ROOT.getMap().put( "customList", list );
     }
 
-    private static Object[][] TESTS = {
-            {ROOT, "myMap", ROOT.getMyMap()},
-            {ROOT, "myMap.test", ROOT},
-            {ROOT.getMyMap(), "list", ROOT.getList()},
-            {ROOT, "myMap.array[0]", new Integer(ROOT.getArray()[0])},
-            {ROOT, "myMap.list[1]", ROOT.getList().get(1)},
-            {ROOT, "myMap[^]", new Integer(99)},
-            {ROOT, "myMap[$]", null},
-            {ROOT.getMyMap(), "array[$]", new Integer(ROOT.getArray()[ROOT.getArray().length - 1])},
-            {ROOT, "[\"myMap\"]", ROOT.getMyMap()},
-            {ROOT, "myMap[null]", null},
-            {ROOT, "myMap[#x = null]", null},
-            {ROOT, "myMap.(null,test)", ROOT},
-            {ROOT, "myMap[null] = 25", new Integer(25)},
-            {ROOT, "myMap[null]", new Integer(25), new Integer(50), new Integer(50)},
-            {ROOT, "beans.testBean", ROOT.getBeans().getBean("testBean")},
-            {ROOT, "beans.evenOdd.next", "even"},
-            {ROOT, "map.comp.form.clientId", "form1"},
-            {ROOT, "map.comp.getCount(genericIndex)", Integer.valueOf(0)},
-            {ROOT, "map.customList.total", Integer.valueOf(1)},
-            {ROOT, "myTest.theMap['key']", "value" },
-            {ROOT, "contentProvider.hasChildren(property)", Boolean.TRUE},
-            {ROOT, "objectIndex instanceof java.lang.Object", Boolean.TRUE}
-    };
+    private static Object[][] TESTS = { { ROOT, "myMap", ROOT.getMyMap() }, { ROOT, "myMap.test", ROOT },
+        { ROOT.getMyMap(), "list", ROOT.getList() }, { ROOT, "myMap.array[0]", new Integer( ROOT.getArray()[0] ) },
+        { ROOT, "myMap.list[1]", ROOT.getList().get( 1 ) }, { ROOT, "myMap[^]", new Integer( 99 ) },
+        { ROOT, "myMap[$]", null },
+        { ROOT.getMyMap(), "array[$]", new Integer( ROOT.getArray()[ROOT.getArray().length - 1] ) },
+        { ROOT, "[\"myMap\"]", ROOT.getMyMap() }, { ROOT, "myMap[null]", null }, { ROOT, "myMap[#x = null]", null },
+        { ROOT, "myMap.(null,test)", ROOT }, { ROOT, "myMap[null] = 25", new Integer( 25 ) },
+        { ROOT, "myMap[null]", new Integer( 25 ), new Integer( 50 ), new Integer( 50 ) },
+        { ROOT, "beans.testBean", ROOT.getBeans().getBean( "testBean" ) }, { ROOT, "beans.evenOdd.next", "even" },
+        { ROOT, "map.comp.form.clientId", "form1" }, { ROOT, "map.comp.getCount(genericIndex)", Integer.valueOf( 0 ) },
+        { ROOT, "map.customList.total", Integer.valueOf( 1 ) }, { ROOT, "myTest.theMap['key']", "value" },
+        { ROOT, "contentProvider.hasChildren(property)", Boolean.TRUE },
+        { ROOT, "objectIndex instanceof java.lang.Object", Boolean.TRUE } };
 
     /*
      * =================================================================== Public static methods
@@ -77,20 +69,31 @@ public class InterfaceInheritanceTest ex
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new InterfaceInheritanceTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                                            TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new InterfaceInheritanceTest((String) TESTS[i][1], TESTS[i][0],
-                                                                (String) TESTS[i][1], TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new InterfaceInheritanceTest((String) TESTS[i][1], TESTS[i][0],
-                                                                    (String) TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new InterfaceInheritanceTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                              TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new InterfaceInheritanceTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                  (String) TESTS[i][1], TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new InterfaceInheritanceTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                      (String) TESTS[i][1], TESTS[i][2], TESTS[i][3],
+                                                                      TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -100,34 +103,34 @@ public class InterfaceInheritanceTest ex
     }
 
     /*
-    * =================================================================== Constructors
-    * ===================================================================
-    */
+     * =================================================================== Constructors
+     * ===================================================================
+     */
     public InterfaceInheritanceTest()
     {
         super();
     }
 
-    public InterfaceInheritanceTest(String name)
+    public InterfaceInheritanceTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public InterfaceInheritanceTest(String name, Object root, String expressionString, Object expectedResult,
-                                    Object setValue, Object expectedAfterSetResult)
+    public InterfaceInheritanceTest( String name, Object root, String expressionString, Object expectedResult,
+                                     Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public InterfaceInheritanceTest(String name, Object root, String expressionString, Object expectedResult,
-                                    Object setValue)
+    public InterfaceInheritanceTest( String name, Object root, String expressionString, Object expectedResult,
+                                     Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public InterfaceInheritanceTest(String name, Object root, String expressionString, Object expectedResult)
+    public InterfaceInheritanceTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     public void setUp()

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/LambdaExpressionTest.java Sat May 14 13:18:29 2011
@@ -25,18 +25,20 @@ import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Arrays;
 
-public class LambdaExpressionTest extends OgnlTestCase {
+public class LambdaExpressionTest
+    extends OgnlTestCase
+{
 
     private static Object[][] TESTS = {
-            // Lambda expressions
-            {null, "#a=:[33](20).longValue().{0}.toArray().length", new Integer(33)},
-            {null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30)", new Integer(1409286144)},
-            {null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30L)", new Long(-8764578968847253504L)},
-            {null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30h)",
-                    new BigInteger("265252859812191058636308480000000")},
-            {null, "#bump = :[ #this.{ #this + 1 } ], (#bump)({ 1, 2, 3 })",
-                    new ArrayList(Arrays.asList(new Integer[]{new Integer(2), new Integer(3), new Integer(4)}))},
-            {null, "#call = :[ \"calling \" + [0] + \" on \" + [1] ], (#call)({ \"x\", \"y\" })", "calling x on y"},
+        // Lambda expressions
+        { null, "#a=:[33](20).longValue().{0}.toArray().length", new Integer( 33 ) },
+        { null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30)", new Integer( 1409286144 ) },
+        { null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30L)", new Long( -8764578968847253504L ) },
+        { null, "#fact=:[#this<=1? 1 : #fact(#this-1) * #this], #fact(30h)",
+            new BigInteger( "265252859812191058636308480000000" ) },
+        { null, "#bump = :[ #this.{ #this + 1 } ], (#bump)({ 1, 2, 3 })",
+            new ArrayList( Arrays.asList( new Integer[] { new Integer( 2 ), new Integer( 3 ), new Integer( 4 ) } ) ) },
+        { null, "#call = :[ \"calling \" + [0] + \" on \" + [1] ], (#call)({ \"x\", \"y\" })", "calling x on y" },
 
     };
 
@@ -48,9 +50,10 @@ public class LambdaExpressionTest extend
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            result.addTest(new LambdaExpressionTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                    TESTS[i][2]));
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            result.addTest( new LambdaExpressionTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                      TESTS[i][2] ) );
         }
         return result;
     }
@@ -64,25 +67,25 @@ public class LambdaExpressionTest extend
         super();
     }
 
-    public LambdaExpressionTest(String name)
+    public LambdaExpressionTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public LambdaExpressionTest(String name, Object root, String expressionString, Object expectedResult,
-                                Object setValue, Object expectedAfterSetResult)
+    public LambdaExpressionTest( String name, Object root, String expressionString, Object expectedResult,
+                                 Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public LambdaExpressionTest(String name, Object root, String expressionString, Object expectedResult,
-                                Object setValue)
+    public LambdaExpressionTest( String name, Object root, String expressionString, Object expectedResult,
+                                 Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public LambdaExpressionTest(String name, Object root, String expressionString, Object expectedResult)
+    public LambdaExpressionTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MapCreationTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MapCreationTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MapCreationTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MapCreationTest.java Sat May 14 13:18:29 2011
@@ -27,39 +27,47 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.TreeMap;
 
-public class MapCreationTest extends OgnlTestCase {
+public class MapCreationTest
+    extends OgnlTestCase
+{
 
     private static Root ROOT = new Root();
+
     private static Map fooBarMap1;
+
     private static Map fooBarMap2;
+
     private static Map fooBarMap3;
+
     private static Map fooBarMap4;
+
     private static Map fooBarMap5;
 
-    static {
+    static
+    {
         fooBarMap1 = new HashMap();
-        fooBarMap1.put("foo", "bar");
+        fooBarMap1.put( "foo", "bar" );
         fooBarMap2 = new HashMap();
-        fooBarMap2.put("foo", "bar");
-        fooBarMap2.put("bar", "baz");
+        fooBarMap2.put( "foo", "bar" );
+        fooBarMap2.put( "bar", "baz" );
         fooBarMap3 = new HashMap();
-        fooBarMap3.put("foo", null);
-        fooBarMap3.put("bar", "baz");
+        fooBarMap3.put( "foo", null );
+        fooBarMap3.put( "bar", "baz" );
         fooBarMap4 = new LinkedHashMap();
-        fooBarMap4.put("foo", "bar");
-        fooBarMap4.put("bar", "baz");
+        fooBarMap4.put( "foo", "bar" );
+        fooBarMap4.put( "bar", "baz" );
         fooBarMap5 = new TreeMap();
-        fooBarMap5.put("foo", "bar");
-        fooBarMap5.put("bar", "baz");
+        fooBarMap5.put( "foo", "bar" );
+        fooBarMap5.put( "bar", "baz" );
     }
 
     private static Object[][] TESTS = {
-            // Map creation
-            {ROOT, "#{ \"foo\" : \"bar\" }", fooBarMap1},
-            {ROOT, "#{ \"foo\" : \"bar\", \"bar\" : \"baz\"  }", fooBarMap2},
-            {ROOT, "#{ \"foo\", \"bar\" : \"baz\"  }", fooBarMap3},
-            {ROOT, "#@java.util.LinkedHashMap@{ \"foo\" : \"bar\", \"bar\" : \"baz\"  }", fooBarMap4},
-            {ROOT, "#@java.util.TreeMap@{ \"foo\" : \"bar\", \"bar\" : \"baz\"  }", fooBarMap5},
+        // Map creation
+        { ROOT, "#{ \"foo\" : \"bar\" }", fooBarMap1 },
+        { ROOT, "#{ \"foo\" : \"bar\", \"bar\" : \"baz\"  }", fooBarMap2 },
+        { ROOT, "#{ \"foo\", \"bar\" : \"baz\"  }", fooBarMap3 },
+        { ROOT, "#@java.util.LinkedHashMap@{ \"foo\" : \"bar\", \"bar\" : \"baz\"  }", fooBarMap4 },
+        { ROOT, "#@java.util.TreeMap@{ \"foo\" : \"bar\", \"bar\" : \"baz\"  }", fooBarMap5 },
 
     };
 
@@ -71,21 +79,30 @@ public class MapCreationTest extends Ogn
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result
-                        .addTest(new MapCreationTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new MapCreationTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                            TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new MapCreationTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new MapCreationTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                     TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new MapCreationTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                         TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new MapCreationTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                             TESTS[i][2], TESTS[i][3], TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -102,24 +119,24 @@ public class MapCreationTest extends Ogn
         super();
     }
 
-    public MapCreationTest(String name)
+    public MapCreationTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public MapCreationTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                           Object expectedAfterSetResult)
+    public MapCreationTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                            Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public MapCreationTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public MapCreationTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public MapCreationTest(String name, Object root, String expressionString, Object expectedResult)
+    public MapCreationTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MemberAccessTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MemberAccessTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MemberAccessTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MemberAccessTest.java Sat May 14 13:18:29 2011
@@ -28,17 +28,17 @@ import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.util.Map;
 
-public class MemberAccessTest extends OgnlTestCase {
+public class MemberAccessTest
+    extends OgnlTestCase
+{
 
     private static Simple ROOT = new Simple();
 
-    private static Object[][] TESTS = {
-            {"@Runtime@getRuntime()", OgnlException.class},
-            {"@System@getProperty('java.specification.version')", System.getProperty("java.specification.version")},
-            {"bigIntValue", OgnlException.class},
-            {"bigIntValue", OgnlException.class, new Integer(25), OgnlException.class},
-            {"getBigIntValue()", OgnlException.class}, {"stringValue", ROOT.getStringValue()},
-    };
+    private static Object[][] TESTS = { { "@Runtime@getRuntime()", OgnlException.class },
+        { "@System@getProperty('java.specification.version')", System.getProperty( "java.specification.version" ) },
+        { "bigIntValue", OgnlException.class },
+        { "bigIntValue", OgnlException.class, new Integer( 25 ), OgnlException.class },
+        { "getBigIntValue()", OgnlException.class }, { "stringValue", ROOT.getStringValue() }, };
 
     /*
      * =================================================================== Public static methods
@@ -48,12 +48,12 @@ public class MemberAccessTest extends Og
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++)
+        for ( int i = 0; i < TESTS.length; i++ )
         {
-            result.addTest(new MemberAccessTest((String) TESTS[i][0] + " (" + TESTS[i][1] + ")", ROOT,
-                                                (String) TESTS[i][0], TESTS[i][1]));
+            result.addTest( new MemberAccessTest( (String) TESTS[i][0] + " (" + TESTS[i][1] + ")", ROOT,
+                                                  (String) TESTS[i][0], TESTS[i][1] ) );
         }
-        
+
         return result;
     }
 
@@ -66,25 +66,25 @@ public class MemberAccessTest extends Og
         super();
     }
 
-    public MemberAccessTest(String name)
+    public MemberAccessTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public MemberAccessTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                            Object expectedAfterSetResult)
+    public MemberAccessTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                             Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public MemberAccessTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public MemberAccessTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public MemberAccessTest(String name, Object root, String expressionString, Object expectedResult)
+    public MemberAccessTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     /*
@@ -94,29 +94,36 @@ public class MemberAccessTest extends Og
     public void setUp()
     {
         super.setUp();
-        
+
         /* Should allow access at all to the Simple class except for the bigIntValue property */
-        _context.setMemberAccess(new DefaultMemberAccess(false) {
+        _context.setMemberAccess( new DefaultMemberAccess( false )
+        {
 
-            public boolean isAccessible(Map context, Object target, Member member, String propertyName)
+            public boolean isAccessible( Map context, Object target, Member member, String propertyName )
             {
-                if (target == Runtime.class) {
+                if ( target == Runtime.class )
+                {
                     return false;
                 }
-                if (target instanceof Simple) {
-                    if (propertyName != null) {
-                        return !propertyName.equals("bigIntValue")
-                               && super.isAccessible(context, target, member, propertyName);
-                    } else {
-                        if (member instanceof Method) {
-                            return !member.getName().equals("getBigIntValue")
-                                   && !member.getName().equals("setBigIntValue")
-                                   && super.isAccessible(context, target, member, propertyName);
+                if ( target instanceof Simple )
+                {
+                    if ( propertyName != null )
+                    {
+                        return !propertyName.equals( "bigIntValue" )
+                            && super.isAccessible( context, target, member, propertyName );
+                    }
+                    else
+                    {
+                        if ( member instanceof Method )
+                        {
+                            return !member.getName().equals( "getBigIntValue" )
+                                && !member.getName().equals( "setBigIntValue" )
+                                && super.isAccessible( context, target, member, propertyName );
                         }
                     }
                 }
-                return super.isAccessible(context, target, member, propertyName);
+                return super.isAccessible( context, target, member, propertyName );
             }
-        });
+        } );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MethodTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MethodTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MethodTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/MethodTest.java Sat May 14 13:18:29 2011
@@ -27,27 +27,25 @@ import org.apache.commons.ognl.test.obje
 import org.apache.commons.ognl.test.objects.ListSourceImpl;
 import org.apache.commons.ognl.test.objects.Simple;
 
-public class MethodTest extends OgnlTestCase
+public class MethodTest
+    extends OgnlTestCase
 {
 
     private static Simple ROOT = new Simple();
+
     private static ListSource LIST = new ListSourceImpl();
+
     private static BaseGeneric<GameGenericObject, Long> GENERIC = new GameGeneric();
 
-    private static Object[][] TESTS = {
-            { "hashCode()", new Integer(ROOT.hashCode()) } ,
-            { "getBooleanValue() ? \"here\" : \"\"", ""},
-            { "getValueIsTrue(!false) ? \"\" : \"here\" ", ""},
-            { "messages.format('ShowAllCount', one)", "foo"},
-            { "getTestValue(@org.apache.commons.ognl.test.objects.SimpleEnum@ONE.value)", new Integer(2)},
-            { "@org.apache.commons.ognl.test.MethodTest@getA().isProperty()", Boolean.FALSE},
-            { "isDisabled()", Boolean.TRUE},
-            { "isEditorDisabled()", Boolean.FALSE},
-            { LIST, "addValue(name)", Boolean.TRUE},
-            { "getDisplayValue(methodsTest.allowDisplay)", "test"},
-            { "isThisVarArgsWorking(three, rootValue)", Boolean.TRUE},
-            { GENERIC, "service.getFullMessageFor(value, null)", "Halo 3"}
-    };
+    private static Object[][] TESTS = { { "hashCode()", new Integer( ROOT.hashCode() ) },
+        { "getBooleanValue() ? \"here\" : \"\"", "" }, { "getValueIsTrue(!false) ? \"\" : \"here\" ", "" },
+        { "messages.format('ShowAllCount', one)", "foo" },
+        { "getTestValue(@org.apache.commons.ognl.test.objects.SimpleEnum@ONE.value)", new Integer( 2 ) },
+        { "@org.apache.commons.ognl.test.MethodTest@getA().isProperty()", Boolean.FALSE },
+        { "isDisabled()", Boolean.TRUE }, { "isEditorDisabled()", Boolean.FALSE },
+        { LIST, "addValue(name)", Boolean.TRUE }, { "getDisplayValue(methodsTest.allowDisplay)", "test" },
+        { "isThisVarArgsWorking(three, rootValue)", Boolean.TRUE },
+        { GENERIC, "service.getFullMessageFor(value, null)", "Halo 3" } };
 
     public static class A
     {
@@ -63,20 +61,24 @@ public class MethodTest extends OgnlTest
     }
 
     /*
-    * =================================================================== Public static methods
-    * ===================================================================
-    */
+     * =================================================================== Public static methods
+     * ===================================================================
+     */
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3)
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
             {
-                result.addTest(new MethodTest((String) TESTS[i][1] + " (" + TESTS[i][2] + ")", TESTS[i][0], (String) TESTS[i][1], TESTS[i][2]));
-            } else
+                result.addTest( new MethodTest( (String) TESTS[i][1] + " (" + TESTS[i][2] + ")", TESTS[i][0],
+                                                (String) TESTS[i][1], TESTS[i][2] ) );
+            }
+            else
             {
-                result.addTest(new MethodTest((String) TESTS[i][0] + " (" + TESTS[i][1] + ")", ROOT, (String) TESTS[i][0], TESTS[i][1]));
+                result.addTest( new MethodTest( (String) TESTS[i][0] + " (" + TESTS[i][1] + ")", ROOT,
+                                                (String) TESTS[i][0], TESTS[i][1] ) );
             }
         }
         return result;
@@ -91,24 +93,24 @@ public class MethodTest extends OgnlTest
         super();
     }
 
-    public MethodTest(String name)
+    public MethodTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public MethodTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                      Object expectedAfterSetResult)
+    public MethodTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                       Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public MethodTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public MethodTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public MethodTest(String name, Object root, String expressionString, Object expectedResult)
+    public MethodTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }



Mime
View raw message