You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/14 15:18:36 UTC

svn commit: r1103095 [18/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/...

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/TestOgnlRuntime.java Sat May 14 13:18:29 2011
@@ -46,49 +46,54 @@ import java.util.List;
 /**
  * Tests various methods / functionality of {@link org.apache.commons.ognl.OgnlRuntime}.
  */
-public class TestOgnlRuntime extends TestCase {
+public class TestOgnlRuntime
+    extends TestCase
+{
 
-    
-    public void test_Get_Super_Or_Interface_Class() throws Exception
+    public void test_Get_Super_Or_Interface_Class()
+        throws Exception
     {
         ListSource list = new ListSourceImpl();
 
-        Method m = OgnlRuntime.getReadMethod(list.getClass(), "total");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getReadMethod( list.getClass(), "total" );
+        assertNotNull( m );
 
-        assertEquals(ListSource.class, OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, list.getClass()));
+        assertEquals( ListSource.class, OgnlRuntime.getCompiler().getSuperOrInterfaceClass( m, list.getClass() ) );
     }
 
-    public void test_Get_Private_Class() throws Exception
+    public void test_Get_Private_Class()
+        throws Exception
     {
-        List list = Arrays.asList(new String[]{"hello", "world"});
+        List list = Arrays.asList( new String[] { "hello", "world" } );
 
-        Method m = OgnlRuntime.getReadMethod(list.getClass(), "iterator");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getReadMethod( list.getClass(), "iterator" );
+        assertNotNull( m );
 
-        assertEquals(Iterable.class, OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, list.getClass()));
+        assertEquals( Iterable.class, OgnlRuntime.getCompiler().getSuperOrInterfaceClass( m, list.getClass() ) );
     }
 
-    public void test_Complicated_Inheritance() throws Exception
+    public void test_Complicated_Inheritance()
+        throws Exception
     {
         IForm form = new FormImpl();
 
-        Method m = OgnlRuntime.getWriteMethod(form.getClass(), "clientId");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getWriteMethod( form.getClass(), "clientId" );
+        assertNotNull( m );
 
-        assertEquals(IComponent.class, OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, form.getClass()));
+        assertEquals( IComponent.class, OgnlRuntime.getCompiler().getSuperOrInterfaceClass( m, form.getClass() ) );
     }
 
     public void test_Get_Read_Method()
-            throws Exception
+        throws Exception
     {
-        Method m = OgnlRuntime.getReadMethod(Bean2.class, "pageBreakAfter");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getReadMethod( Bean2.class, "pageBreakAfter" );
+        assertNotNull( m );
 
-        assertEquals("isPageBreakAfter", m.getName());
+        assertEquals( "isPageBreakAfter", m.getName() );
     }
 
-    class TestGetters {
+    class TestGetters
+    {
         public boolean isEditorDisabled()
         {
             return false;
@@ -99,134 +104,141 @@ public class TestOgnlRuntime extends Tes
             return true;
         }
 
-        public boolean isNotAvailable() {
+        public boolean isNotAvailable()
+        {
             return false;
         }
 
-        public boolean isAvailable() {
+        public boolean isAvailable()
+        {
             return true;
         }
     }
 
     public void test_Get_Read_Method_Multiple()
-            throws Exception
+        throws Exception
     {
-        Method m = OgnlRuntime.getReadMethod(TestGetters.class, "disabled");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getReadMethod( TestGetters.class, "disabled" );
+        assertNotNull( m );
 
-        assertEquals("isDisabled", m.getName());
+        assertEquals( "isDisabled", m.getName() );
     }
 
     public void test_Get_Read_Method_Multiple_Boolean_Getters()
-            throws Exception
+        throws Exception
     {
-        Method m = OgnlRuntime.getReadMethod(TestGetters.class, "available");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getReadMethod( TestGetters.class, "available" );
+        assertNotNull( m );
 
-        assertEquals("isAvailable", m.getName());
+        assertEquals( "isAvailable", m.getName() );
 
-        m = OgnlRuntime.getReadMethod(TestGetters.class, "notAvailable");
-        assertNotNull(m);
+        m = OgnlRuntime.getReadMethod( TestGetters.class, "notAvailable" );
+        assertNotNull( m );
 
-        assertEquals("isNotAvailable", m.getName());
+        assertEquals( "isNotAvailable", m.getName() );
     }
 
     public void test_Find_Method_Mixed_Boolean_Getters()
-    throws Exception
+        throws Exception
     {
-        Method m = OgnlRuntime.getReadMethod(GetterMethods.class, "allowDisplay");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getReadMethod( GetterMethods.class, "allowDisplay" );
+        assertNotNull( m );
 
-        assertEquals("getAllowDisplay", m.getName());
+        assertEquals( "getAllowDisplay", m.getName() );
     }
 
     public void test_Get_Appropriate_Method()
-            throws Exception
+        throws Exception
     {
         ListSource list = new ListSourceImpl();
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+
+        Object ret = OgnlRuntime.callMethod( context, list, "addValue", new String[] { null } );
 
-        Object ret = OgnlRuntime.callMethod(context, list, "addValue", new String[] {null});
-        
         assert ret != null;
     }
 
     public void test_Call_Static_Method_Invalid_Class()
     {
 
-        try {
+        try
+        {
 
-            OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-            OgnlRuntime.callStaticMethod(context, "made.up.Name", "foo", null);
+            OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+            OgnlRuntime.callStaticMethod( context, "made.up.Name", "foo", null );
 
-            fail("ClassNotFoundException should have been thrown by previous reference to <made.up.Name> class.");
-        } catch (Exception et) {
+            fail( "ClassNotFoundException should have been thrown by previous reference to <made.up.Name> class." );
+        }
+        catch ( Exception et )
+        {
 
-            assertTrue(MethodFailedException.class.isInstance(et));
-            assertTrue(et.getMessage().indexOf("made.up.Name") > -1);
+            assertTrue( MethodFailedException.class.isInstance( et ) );
+            assertTrue( et.getMessage().indexOf( "made.up.Name" ) > -1 );
         }
     }
 
     public void test_Setter_Returns()
-            throws Exception
+        throws Exception
     {
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
         SetterReturns root = new SetterReturns();
 
-        Method m = OgnlRuntime.getWriteMethod(root.getClass(), "value");
-        assertTrue(m != null);
+        Method m = OgnlRuntime.getWriteMethod( root.getClass(), "value" );
+        assertTrue( m != null );
 
-        Ognl.setValue("value", context, root, "12__");
-        assertEquals(Ognl.getValue("value", context, root), "12__");
+        Ognl.setValue( "value", context, root, "12__" );
+        assertEquals( Ognl.getValue( "value", context, root ), "12__" );
     }
 
     public void test_Call_Method_VarArgs()
-            throws Exception
+        throws Exception
     {
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
         GenericService service = new GenericServiceImpl();
 
         GameGenericObject argument = new GameGenericObject();
 
-        Object[] args = OgnlRuntime.getObjectArrayPool().create(2);
+        Object[] args = OgnlRuntime.getObjectArrayPool().create( 2 );
         args[0] = argument;
 
-        assertEquals("Halo 3", OgnlRuntime.callMethod(context, service, "getFullMessageFor", args));
+        assertEquals( "Halo 3", OgnlRuntime.callMethod( context, service, "getFullMessageFor", args ) );
     }
 
     public void test_Class_Cache_Inspector()
-            throws Exception
+        throws Exception
     {
         OgnlRuntime.clearCache();
-        assertEquals(0, OgnlRuntime._propertyDescriptorCache.getSize());
+        assertEquals( 0, OgnlRuntime._propertyDescriptorCache.getSize() );
 
         Root root = new Root();
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        Node expr = Ognl.compileExpression(context, root, "property.bean3.value != null");
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        Node expr = Ognl.compileExpression( context, root, "property.bean3.value != null" );
 
-        assertTrue((Boolean)expr.getAccessor().get(context, root));
+        assertTrue( (Boolean) expr.getAccessor().get( context, root ) );
 
         int size = OgnlRuntime._propertyDescriptorCache.getSize();
-        assertTrue(size > 0);
+        assertTrue( size > 0 );
 
         OgnlRuntime.clearCache();
-        assertEquals(0, OgnlRuntime._propertyDescriptorCache.getSize());
+        assertEquals( 0, OgnlRuntime._propertyDescriptorCache.getSize() );
 
         // now register class cache prevention
 
-        OgnlRuntime.setClassCacheInspector(new TestCacheInspector());
+        OgnlRuntime.setClassCacheInspector( new TestCacheInspector() );
 
-        expr = Ognl.compileExpression(context, root, "property.bean3.value != null");
-        assertTrue((Boolean)expr.getAccessor().get(context, root));
+        expr = Ognl.compileExpression( context, root, "property.bean3.value != null" );
+        assertTrue( (Boolean) expr.getAccessor().get( context, root ) );
 
-        assertEquals((size - 1), OgnlRuntime._propertyDescriptorCache.getSize());
+        assertEquals( ( size - 1 ), OgnlRuntime._propertyDescriptorCache.getSize() );
     }
 
-    class TestCacheInspector implements ClassCacheInspector {
+    class TestCacheInspector
+        implements ClassCacheInspector
+    {
 
-        public boolean shouldCache(Class type)
+        public boolean shouldCache( Class type )
         {
-            if (type == null || type == Root.class)
+            if ( type == null || type == Root.class )
                 return false;
 
             return true;
@@ -236,106 +248,110 @@ public class TestOgnlRuntime extends Tes
     public void test_Set_Generic_Parameter_Types()
         throws Exception
     {
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        Method m = OgnlRuntime.getSetMethod(context, GenericCracker.class, "param");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getSetMethod( context, GenericCracker.class, "param" );
+        assertNotNull( m );
 
         Class[] types = m.getParameterTypes();
-        assertEquals(1, types.length);
-        assertEquals(Integer.class, types[0]);
+        assertEquals( 1, types.length );
+        assertEquals( Integer.class, types[0] );
     }
 
     public void test_Get_Generic_Parameter_Types()
         throws Exception
     {
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        Method m = OgnlRuntime.getGetMethod(context, GenericCracker.class, "param");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getGetMethod( context, GenericCracker.class, "param" );
+        assertNotNull( m );
 
-        assertEquals(Integer.class, m.getReturnType());
+        assertEquals( Integer.class, m.getReturnType() );
     }
 
     public void test_Find_Parameter_Types()
-            throws Exception
+        throws Exception
     {
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        Method m = OgnlRuntime.getSetMethod(context, GameGeneric.class, "ids");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getSetMethod( context, GameGeneric.class, "ids" );
+        assertNotNull( m );
 
-        Class[] types = OgnlRuntime.findParameterTypes(GameGeneric.class, m);
-        assertEquals(1, types.length);
-        assertEquals(new Long[0].getClass(), types[0]);
+        Class[] types = OgnlRuntime.findParameterTypes( GameGeneric.class, m );
+        assertEquals( 1, types.length );
+        assertEquals( new Long[0].getClass(), types[0] );
     }
 
     public void test_Find_Parameter_Types_Superclass()
-            throws Exception
+        throws Exception
     {
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        Method m = OgnlRuntime.getSetMethod(context, BaseGeneric.class, "ids");
-        assertNotNull(m);
+        Method m = OgnlRuntime.getSetMethod( context, BaseGeneric.class, "ids" );
+        assertNotNull( m );
 
-        Class[] types = OgnlRuntime.findParameterTypes(BaseGeneric.class, m);
-        assertEquals(1, types.length);
-        assertEquals(new Serializable[0].getClass(), types[0]);
+        Class[] types = OgnlRuntime.findParameterTypes( BaseGeneric.class, m );
+        assertEquals( 1, types.length );
+        assertEquals( new Serializable[0].getClass(), types[0] );
     }
 
     public void test_Get_Declared_Methods_With_Synthetic_Methods()
         throws Exception
     {
-        List result = OgnlRuntime.getDeclaredMethods(SubclassSyntheticObject.class, "list", false);
+        List result = OgnlRuntime.getDeclaredMethods( SubclassSyntheticObject.class, "list", false );
 
-        // synthetic method would be "public volatile java.util.List org.ognl.test.objects.SubclassSyntheticObject.getList()",
+        // synthetic method would be
+        // "public volatile java.util.List org.ognl.test.objects.SubclassSyntheticObject.getList()",
         // causing method return size to be 3
-        
-        assertEquals(2, result.size());
+
+        assertEquals( 2, result.size() );
     }
 
     public void test_Get_Property_Descriptors_With_Synthetic_Methods()
         throws Exception
     {
-        PropertyDescriptor pd = OgnlRuntime.getPropertyDescriptor(SubclassSyntheticObject.class, "list");
+        PropertyDescriptor pd = OgnlRuntime.getPropertyDescriptor( SubclassSyntheticObject.class, "list" );
 
         assert pd != null;
-        assert OgnlRuntime.isMethodCallable(pd.getReadMethod());
+        assert OgnlRuntime.isMethodCallable( pd.getReadMethod() );
     }
 
     private static class GenericParent<T>
-     {
-         public void save(T entity)
-         {
-
-         }
-     }
-
-     private static class StringChild extends GenericParent<String>
-     {
-
-     }
-
-     private static class LongChild extends GenericParent<Long>
-     {
-
-     }
-
-     /**
-      * Tests OGNL parameter discovery.
-      */
-     public void testOGNLParameterDiscovery() throws NoSuchMethodException
-     {
-         Method saveMethod = GenericParent.class.getMethod("save", Object.class);
-         System.out.println(saveMethod);
-
-         Class[] longClass = OgnlRuntime.findParameterTypes(LongChild.class, saveMethod);
-         assertNotSame(longClass[0], String.class);
-         assertSame(longClass[0], Long.class);
-
-         Class[] stringClass = OgnlRuntime.findParameterTypes(StringChild.class, saveMethod);
-         assertNotSame("The cached parameter types from previous calls are used", stringClass[0], Long.class);
-         assertSame(stringClass[0], String.class);
-     }
+    {
+        public void save( T entity )
+        {
+
+        }
+    }
+
+    private static class StringChild
+        extends GenericParent<String>
+    {
+
+    }
+
+    private static class LongChild
+        extends GenericParent<Long>
+    {
+
+    }
+
+    /**
+     * Tests OGNL parameter discovery.
+     */
+    public void testOGNLParameterDiscovery()
+        throws NoSuchMethodException
+    {
+        Method saveMethod = GenericParent.class.getMethod( "save", Object.class );
+        System.out.println( saveMethod );
+
+        Class[] longClass = OgnlRuntime.findParameterTypes( LongChild.class, saveMethod );
+        assertNotSame( longClass[0], String.class );
+        assertSame( longClass[0], Long.class );
+
+        Class[] stringClass = OgnlRuntime.findParameterTypes( StringChild.class, saveMethod );
+        assertNotSame( "The cached parameter types from previous calls are used", stringClass[0], Long.class );
+        assertSame( stringClass[0], String.class );
+    }
 
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTChainTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTChainTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTChainTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTChainTest.java Sat May 14 13:18:29 2011
@@ -27,19 +27,23 @@ import org.apache.commons.ognl.test.obje
 /**
  * Tests for {@link ognl.ASTChain}.
  */
-public class ASTChainTest extends TestCase {
+public class ASTChainTest
+    extends TestCase
+{
 
-    public void test_Get_Indexed_Value() throws Exception {
+    public void test_Get_Indexed_Value()
+        throws Exception
+    {
 
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
         IndexedSetObject root = new IndexedSetObject();
 
         String expr = "thing[\"x\"].val";
 
-        assertEquals(1, Ognl.getValue(expr, context, root));
+        assertEquals( 1, Ognl.getValue( expr, context, root ) );
 
-        Ognl.setValue(expr, context, root, new Integer(2));
-        
-        assertEquals(2, Ognl.getValue(expr, context, root));
+        Ognl.setValue( expr, context, root, new Integer( 2 ) );
+
+        assertEquals( 2, Ognl.getValue( expr, context, root ) );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTMethodTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTMethodTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTMethodTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTMethodTest.java Sat May 14 13:18:29 2011
@@ -31,53 +31,55 @@ import java.util.Map;
 /**
  * Tests {@link ognl.ASTMethod}.
  */
-public class ASTMethodTest extends TestCase {
+public class ASTMethodTest
+    extends TestCase
+{
 
     public void test_Context_Types()
-            throws Throwable
+        throws Throwable
     {
-        ASTMethod p = new ASTMethod(0);
-        p.setMethodName("get");
-        
-        ASTConst pRef = new ASTConst(0);
-        pRef.setValue("value");
-        p.jjtAddChild(pRef, 0);
-        
+        ASTMethod p = new ASTMethod( 0 );
+        p.setMethodName( "get" );
+
+        ASTConst pRef = new ASTConst( 0 );
+        pRef.setValue( "value" );
+        p.jjtAddChild( pRef, 0 );
+
         Root root = new Root();
 
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root.getMap());
-        context.setCurrentObject(root.getMap());
-        context.setCurrentType(root.getMap().getClass());
-        
-        assertEquals(p.toGetSourceString(context, root.getMap()), ".get(\"value\")");
-        assertEquals(context.getCurrentType(), Object.class);
-        assertEquals(root.getMap().get("value"), context.getCurrentObject());
-        assert Map.class.isAssignableFrom(context.getCurrentAccessor());
-        assert Map.class.isAssignableFrom(context.getPreviousType());
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root.getMap() );
+        context.setCurrentObject( root.getMap() );
+        context.setCurrentType( root.getMap().getClass() );
+
+        assertEquals( p.toGetSourceString( context, root.getMap() ), ".get(\"value\")" );
+        assertEquals( context.getCurrentType(), Object.class );
+        assertEquals( root.getMap().get( "value" ), context.getCurrentObject() );
+        assert Map.class.isAssignableFrom( context.getCurrentAccessor() );
+        assert Map.class.isAssignableFrom( context.getPreviousType() );
         assert context.getPreviousAccessor() == null;
-        
-        assertEquals(OgnlRuntime.getCompiler().castExpression(context, p, ".get(\"value\")"),  ".get(\"value\")");
-        assert context.get(ExpressionCompiler.PRE_CAST) == null;
-        
+
+        assertEquals( OgnlRuntime.getCompiler().castExpression( context, p, ".get(\"value\")" ), ".get(\"value\")" );
+        assert context.get( ExpressionCompiler.PRE_CAST ) == null;
+
         // now test one context level further to see casting work properly on base object types
-        
-        ASTProperty prop = new ASTProperty(0);
-        ASTConst propRef = new ASTConst(0);
-        propRef.setValue("bean3");
-        prop.jjtAddChild(propRef, 0);
-
-        Bean2 val = (Bean2)root.getMap().get("value");
-        
-        assertEquals(prop.toGetSourceString(context, root.getMap().get("value")), ".getBean3()");
-
-        assertEquals(context.getCurrentObject(), val.getBean3());
-        assertEquals(context.getCurrentType(), Bean3.class);
-        assertEquals(context.getCurrentAccessor(), Bean2.class);
-        assertEquals(Object.class, context.getPreviousType());
-        assert Map.class.isAssignableFrom(context.getPreviousAccessor());
-        
-        assertEquals(OgnlRuntime.getCompiler().castExpression(context, prop, ".getBean3()"), ").getBean3()");
-        
+
+        ASTProperty prop = new ASTProperty( 0 );
+        ASTConst propRef = new ASTConst( 0 );
+        propRef.setValue( "bean3" );
+        prop.jjtAddChild( propRef, 0 );
+
+        Bean2 val = (Bean2) root.getMap().get( "value" );
+
+        assertEquals( prop.toGetSourceString( context, root.getMap().get( "value" ) ), ".getBean3()" );
+
+        assertEquals( context.getCurrentObject(), val.getBean3() );
+        assertEquals( context.getCurrentType(), Bean3.class );
+        assertEquals( context.getCurrentAccessor(), Bean2.class );
+        assertEquals( Object.class, context.getPreviousType() );
+        assert Map.class.isAssignableFrom( context.getPreviousAccessor() );
+
+        assertEquals( OgnlRuntime.getCompiler().castExpression( context, prop, ".getBean3()" ), ").getBean3()" );
+
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ASTPropertyTest.java Sat May 14 13:18:29 2011
@@ -41,278 +41,292 @@ import static org.apache.commons.ognl.te
 /**
  * Tests functionality of {@link org.apache.commons.ognl.ASTProperty}.
  */
-public class ASTPropertyTest extends TestCase {
+public class ASTPropertyTest
+    extends TestCase
+{
 
-    public void test_Get_Indexed_Property_Type() throws Exception
+    public void test_Get_Indexed_Property_Type()
+        throws Exception
     {
-        ASTProperty p = new ASTProperty(0);
-        p.setIndexedAccess(false);
-        ASTConst pRef = new ASTConst(0);
-        pRef.setValue("nested");
-        pRef.jjtSetParent(p);
-        p.jjtAddChild(pRef, 0);
+        ASTProperty p = new ASTProperty( 0 );
+        p.setIndexedAccess( false );
+        ASTConst pRef = new ASTConst( 0 );
+        pRef.setValue( "nested" );
+        pRef.jjtSetParent( p );
+        p.jjtAddChild( pRef, 0 );
 
         Map root = new Root().getMap();
 
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root);
-        context.setCurrentObject(root);
-        context.setCurrentNode(pRef);
-
-        assertEquals(root.getClass(), context.getCurrentType());
-        assertEquals(null, context.getPreviousType());
-        assertEquals(root, context.getCurrentObject());
-        assertEquals(null, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousAccessor());
-
-        int type = p.getIndexedPropertyType(context, root);
-
-        assertEquals(OgnlRuntime.INDEXED_PROPERTY_NONE, type);
-        assertEquals(root.getClass(), context.getCurrentType());
-        assertEquals(null, context.getPreviousType());
-        assertEquals(null, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousAccessor());
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root );
+        context.setCurrentObject( root );
+        context.setCurrentNode( pRef );
+
+        assertEquals( root.getClass(), context.getCurrentType() );
+        assertEquals( null, context.getPreviousType() );
+        assertEquals( root, context.getCurrentObject() );
+        assertEquals( null, context.getCurrentAccessor() );
+        assertEquals( null, context.getPreviousAccessor() );
+
+        int type = p.getIndexedPropertyType( context, root );
+
+        assertEquals( OgnlRuntime.INDEXED_PROPERTY_NONE, type );
+        assertEquals( root.getClass(), context.getCurrentType() );
+        assertEquals( null, context.getPreviousType() );
+        assertEquals( null, context.getCurrentAccessor() );
+        assertEquals( null, context.getPreviousAccessor() );
     }
 
-    public void test_Get_Value_Body() throws Exception
+    public void test_Get_Value_Body()
+        throws Exception
     {
-        ASTProperty p = new ASTProperty(0);
-        p.setIndexedAccess(false);
-        ASTConst pRef = new ASTConst(0);
-        pRef.setValue("nested");
-        pRef.jjtSetParent(p);
-        p.jjtAddChild(pRef, 0);
+        ASTProperty p = new ASTProperty( 0 );
+        p.setIndexedAccess( false );
+        ASTConst pRef = new ASTConst( 0 );
+        pRef.setValue( "nested" );
+        pRef.jjtSetParent( p );
+        p.jjtAddChild( pRef, 0 );
 
         Map root = new Root().getMap();
 
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root);
-        context.setCurrentObject(root);
-        context.setCurrentNode(pRef);
-
-        assertEquals(root.getClass(), context.getCurrentType());
-        assertEquals(null, context.getPreviousType());
-        assertEquals(root, context.getCurrentObject());
-        assertEquals(null, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousAccessor());
-
-        Object value = p.getValue(context, root);
-
-        assertEquals(root.get("nested"), value);
-        assertEquals(root.getClass(), context.getCurrentType());
-        assertEquals(null, context.getPreviousType());
-        assertEquals(null, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousAccessor());
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root );
+        context.setCurrentObject( root );
+        context.setCurrentNode( pRef );
+
+        assertEquals( root.getClass(), context.getCurrentType() );
+        assertEquals( null, context.getPreviousType() );
+        assertEquals( root, context.getCurrentObject() );
+        assertEquals( null, context.getCurrentAccessor() );
+        assertEquals( null, context.getPreviousAccessor() );
+
+        Object value = p.getValue( context, root );
+
+        assertEquals( root.get( "nested" ), value );
+        assertEquals( root.getClass(), context.getCurrentType() );
+        assertEquals( null, context.getPreviousType() );
+        assertEquals( null, context.getCurrentAccessor() );
+        assertEquals( null, context.getPreviousAccessor() );
     }
 
     public void test_Get_Source()
-            throws Throwable
+        throws Throwable
     {
-        ASTProperty p = new ASTProperty(0);
-        p.setIndexedAccess(false);
-        ASTConst pRef = new ASTConst(0);
-        pRef.setValue("nested");
-        pRef.jjtSetParent(p);
-        p.jjtAddChild(pRef, 0);
+        ASTProperty p = new ASTProperty( 0 );
+        p.setIndexedAccess( false );
+        ASTConst pRef = new ASTConst( 0 );
+        pRef.setValue( "nested" );
+        pRef.jjtSetParent( p );
+        p.jjtAddChild( pRef, 0 );
 
         Map root = new Root().getMap();
-        
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root);
-        context.setCurrentObject(root);
-        context.setCurrentNode(pRef);
-        
-        assertEquals(".get(\"nested\")", p.toGetSourceString(context, root));
-        assertEquals(Object.class, context.getCurrentType());
-        assertEquals(Map.class, context.getCurrentAccessor());
-        assertEquals(root.getClass(), context.getPreviousType());
-        assertEquals(null, context.getPreviousAccessor());
 
-        assertEquals(root.get("nested"), context.getCurrentObject());
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root );
+        context.setCurrentObject( root );
+        context.setCurrentNode( pRef );
+
+        assertEquals( ".get(\"nested\")", p.toGetSourceString( context, root ) );
+        assertEquals( Object.class, context.getCurrentType() );
+        assertEquals( Map.class, context.getCurrentAccessor() );
+        assertEquals( root.getClass(), context.getPreviousType() );
+        assertEquals( null, context.getPreviousAccessor() );
 
-        assert Map.class.isAssignableFrom(context.getCurrentAccessor());
+        assertEquals( root.get( "nested" ), context.getCurrentObject() );
 
-        assertEquals(root.getClass(), context.getPreviousType());
-        assertEquals(null, context.getPreviousAccessor());
+        assert Map.class.isAssignableFrom( context.getCurrentAccessor() );
+
+        assertEquals( root.getClass(), context.getPreviousType() );
+        assertEquals( null, context.getPreviousAccessor() );
     }
 
     public void test_Set_Source()
-            throws Throwable
+        throws Throwable
     {
-        ASTProperty p = new ASTProperty(0);
-        p.setIndexedAccess(false);
-        ASTConst pRef = new ASTConst(0);
-        pRef.setValue("nested");
-        pRef.jjtSetParent(p);
-        p.jjtAddChild(pRef, 0);
-        
+        ASTProperty p = new ASTProperty( 0 );
+        p.setIndexedAccess( false );
+        ASTConst pRef = new ASTConst( 0 );
+        pRef.setValue( "nested" );
+        pRef.jjtSetParent( p );
+        p.jjtAddChild( pRef, 0 );
+
         Map root = new Root().getMap();
 
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root);
-        context.setCurrentObject(root);
-        context.setCurrentNode(pRef);
-        
-        assertEquals(".put(\"nested\", $3)", p.toSetSourceString(context, root));
-        assertEquals(Object.class, context.getCurrentType());
-        assertEquals(root.get("nested"), context.getCurrentObject());
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root );
+        context.setCurrentObject( root );
+        context.setCurrentNode( pRef );
+
+        assertEquals( ".put(\"nested\", $3)", p.toSetSourceString( context, root ) );
+        assertEquals( Object.class, context.getCurrentType() );
+        assertEquals( root.get( "nested" ), context.getCurrentObject() );
 
-        assert Map.class.isAssignableFrom(context.getCurrentAccessor());
+        assert Map.class.isAssignableFrom( context.getCurrentAccessor() );
 
-        assertEquals(root.getClass(), context.getPreviousType());
-        assertEquals(null, context.getPreviousAccessor());
+        assertEquals( root.getClass(), context.getPreviousType() );
+        assertEquals( null, context.getPreviousAccessor() );
     }
 
     public void test_Indexed_Object_Type()
-            throws Throwable
+        throws Throwable
     {
-        //ASTChain chain = new ASTChain(0);
-        
-        ASTProperty listp = new ASTProperty(0);
-        listp.setIndexedAccess(false);
-        //listp.jjtSetParent(chain);
-
-        ASTConst listc = new ASTConst(0);
-        listc.setValue("list");
-        listc.jjtSetParent(listp);
-        listp.jjtAddChild(listc, 0);
-
-        //chain.jjtAddChild(listp, 0);
-
-        ASTProperty p = new ASTProperty(0);
-        p.setIndexedAccess(true);
-
-        ASTProperty pindex = new ASTProperty(0);
-
-        ASTConst pRef = new ASTConst(0);
-        pRef.setValue("genericIndex");
-        pRef.jjtSetParent(pindex);
-        pindex.jjtAddChild(pRef, 0);
-        
-        p.jjtAddChild(pindex, 0);
-        //chain.jjtAddChild(p, 1);
-        
+        // ASTChain chain = new ASTChain(0);
+
+        ASTProperty listp = new ASTProperty( 0 );
+        listp.setIndexedAccess( false );
+        // listp.jjtSetParent(chain);
+
+        ASTConst listc = new ASTConst( 0 );
+        listc.setValue( "list" );
+        listc.jjtSetParent( listp );
+        listp.jjtAddChild( listc, 0 );
+
+        // chain.jjtAddChild(listp, 0);
+
+        ASTProperty p = new ASTProperty( 0 );
+        p.setIndexedAccess( true );
+
+        ASTProperty pindex = new ASTProperty( 0 );
+
+        ASTConst pRef = new ASTConst( 0 );
+        pRef.setValue( "genericIndex" );
+        pRef.jjtSetParent( pindex );
+        pindex.jjtAddChild( pRef, 0 );
+
+        p.jjtAddChild( pindex, 0 );
+        // chain.jjtAddChild(p, 1);
+
         Root root = new Root();
 
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root);
-        context.setCurrentObject(root);
-        context.setCurrentNode(listp);
-
-        assertEquals(".getList()", listp.toGetSourceString(context, root));
-        assertEquals(List.class, context.getCurrentType());
-        assertEquals(Root.class, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousAccessor());
-        assertEquals(root.getClass(), context.getPreviousType());
-        assertEquals(root.getList(), context.getCurrentObject());
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root );
+        context.setCurrentObject( root );
+        context.setCurrentNode( listp );
+
+        assertEquals( ".getList()", listp.toGetSourceString( context, root ) );
+        assertEquals( List.class, context.getCurrentType() );
+        assertEquals( Root.class, context.getCurrentAccessor() );
+        assertEquals( null, context.getPreviousAccessor() );
+        assertEquals( root.getClass(), context.getPreviousType() );
+        assertEquals( root.getList(), context.getCurrentObject() );
 
         // re test with chain
-        
-        context = (OgnlContext) Ognl.createDefaultContext(null);
-        context.setRoot(root);
-        context.setCurrentObject(root);
-
-        ASTChain chain = new ASTChain(0);
-        listp.jjtSetParent(chain);
-        chain.jjtAddChild(listp, 0);
-
-        context.setCurrentNode(chain);
-
-        assertEquals(".getList()", chain.toGetSourceString(context, root));
-        assertEquals(List.class, context.getCurrentType());
-        assertEquals(Root.class, context.getCurrentAccessor());
-        assertEquals(null, context.getPreviousAccessor());
-        assertEquals(Root.class, context.getPreviousType());
-        assertEquals(root.getList(), context.getCurrentObject());
+
+        context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setRoot( root );
+        context.setCurrentObject( root );
+
+        ASTChain chain = new ASTChain( 0 );
+        listp.jjtSetParent( chain );
+        chain.jjtAddChild( listp, 0 );
+
+        context.setCurrentNode( chain );
+
+        assertEquals( ".getList()", chain.toGetSourceString( context, root ) );
+        assertEquals( List.class, context.getCurrentType() );
+        assertEquals( Root.class, context.getCurrentAccessor() );
+        assertEquals( null, context.getPreviousAccessor() );
+        assertEquals( Root.class, context.getPreviousType() );
+        assertEquals( root.getList(), context.getCurrentObject() );
 
         // test with only getIndex
 
-        assertEquals(".get(org.apache.commons.ognl.OgnlOps#getIntValue(((org.apache.commons.ognl.test.objects.Root)$2)..getGenericIndex().toString()))", p.toGetSourceString(context, root.getList()));
-        assertEquals(root.getArray(), context.getCurrentObject());
-        assertEquals(Object.class, context.getCurrentType());
+        assertEquals( ".get(org.apache.commons.ognl.OgnlOps#getIntValue(((org.apache.commons.ognl.test.objects.Root)$2)..getGenericIndex().toString()))",
+                      p.toGetSourceString( context, root.getList() ) );
+        assertEquals( root.getArray(), context.getCurrentObject() );
+        assertEquals( Object.class, context.getCurrentType() );
     }
 
-    public void test_Complicated_List() throws Exception
+    public void test_Complicated_List()
+        throws Exception
     {
         Root root = new Root();
-        OgnlContext context = (OgnlContext)Ognl.createDefaultContext(null);
-        
-        SimpleNode node = (SimpleNode) Ognl.compileExpression(context, root,
-                "{ new org.apache.commons.ognl.test.objects.MenuItem('Home', 'Main', "
-                    + "{ new org.apache.commons.ognl.test.objects.MenuItem('Help', 'Help'), "
-                    + "new org.apache.commons.ognl.test.objects.MenuItem('Contact', 'Contact') }), " // end first item
-                    + "new org.apache.commons.ognl.test.objects.MenuItem('UserList', getMessages().getMessage('menu.members')), " +
-                    "new org.apache.commons.ognl.test.objects.MenuItem('account/BetSlipList', getMessages().getMessage('menu.account'), " +
-                    "{ new org.apache.commons.ognl.test.objects.MenuItem('account/BetSlipList', 'My Bets'), " +
-                    "new org.apache.commons.ognl.test.objects.MenuItem('account/TransactionList', 'My Transactions') }), " +
-                    "new org.apache.commons.ognl.test.objects.MenuItem('About', 'About'), " +
-                    "new org.apache.commons.ognl.test.objects.MenuItem('admin/Admin', getMessages().getMessage('menu.admin'), " +
-                    "{ new org.apache.commons.ognl.test.objects.MenuItem('admin/AddEvent', 'Add event'), " +
-                    "new org.apache.commons.ognl.test.objects.MenuItem('admin/AddResult', 'Add result') })}");
-        
-        assertTrue(List.class.isAssignableFrom(node.getAccessor().get(context, root).getClass()));
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+
+        SimpleNode node =
+            (SimpleNode) Ognl.compileExpression( context,
+                                                 root,
+                                                 "{ new org.apache.commons.ognl.test.objects.MenuItem('Home', 'Main', "
+                                                     + "{ new org.apache.commons.ognl.test.objects.MenuItem('Help', 'Help'), "
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('Contact', 'Contact') }), " // end
+                                                                                                                                      // first
+                                                                                                                                      // item
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('UserList', getMessages().getMessage('menu.members')), "
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('account/BetSlipList', getMessages().getMessage('menu.account'), "
+                                                     + "{ new org.apache.commons.ognl.test.objects.MenuItem('account/BetSlipList', 'My Bets'), "
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('account/TransactionList', 'My Transactions') }), "
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('About', 'About'), "
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('admin/Admin', getMessages().getMessage('menu.admin'), "
+                                                     + "{ new org.apache.commons.ognl.test.objects.MenuItem('admin/AddEvent', 'Add event'), "
+                                                     + "new org.apache.commons.ognl.test.objects.MenuItem('admin/AddResult', 'Add result') })}" );
+
+        assertTrue( List.class.isAssignableFrom( node.getAccessor().get( context, root ).getClass() ) );
     }
 
-    public void test_Set_Chain_Indexed_Property() throws Exception
+    public void test_Set_Chain_Indexed_Property()
+        throws Exception
     {
         Root root = new Root();
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        context.setRoot(root);
-        context.setCurrentObject(root);
+        context.setRoot( root );
+        context.setCurrentObject( root );
 
-        SimpleNode node = (SimpleNode) Ognl.parseExpression("tab.searchCriteriaSelections[index1][index2]");
-        node.setValue(context, root, Boolean.FALSE);
+        SimpleNode node = (SimpleNode) Ognl.parseExpression( "tab.searchCriteriaSelections[index1][index2]" );
+        node.setValue( context, root, Boolean.FALSE );
     }
 
-    public void test_Set_Generic_Property() throws Exception
+    public void test_Set_Generic_Property()
+        throws Exception
     {
         GenericRoot root = new GenericRoot();
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        context.setRoot(root);
-        context.setCurrentObject(root);
+        context.setRoot( root );
+        context.setCurrentObject( root );
 
-        SimpleNode node = (SimpleNode) Ognl.parseExpression("cracker.param");
-        node.setValue(context, root, "0");
+        SimpleNode node = (SimpleNode) Ognl.parseExpression( "cracker.param" );
+        node.setValue( context, root, "0" );
 
-        assertEquals( new Integer(0), root.getCracker().getParam());
+        assertEquals( new Integer( 0 ), root.getCracker().getParam() );
 
-        node.setValue(context, root, "10");
+        node.setValue( context, root, "10" );
 
-        assertEquals(new Integer(10), root.getCracker().getParam());
+        assertEquals( new Integer( 10 ), root.getCracker().getParam() );
     }
 
-    public void test_Get_Generic_Property() throws Exception
+    public void test_Get_Generic_Property()
+        throws Exception
     {
         GenericRoot root = new GenericRoot();
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        context.setRoot(root);
-        context.setCurrentObject(root);
+        context.setRoot( root );
+        context.setCurrentObject( root );
 
-        SimpleNode node = (SimpleNode) Ognl.parseExpression("cracker.param");
-        node.setValue(context, root, "0");
+        SimpleNode node = (SimpleNode) Ognl.parseExpression( "cracker.param" );
+        node.setValue( context, root, "0" );
 
-        assertEquals(new Integer(0), node.getValue(context, root));
+        assertEquals( new Integer( 0 ), node.getValue( context, root ) );
 
-        node.setValue(context, root, "10");
+        node.setValue( context, root, "10" );
 
-        assertEquals(new Integer(10), node.getValue(context, root));
+        assertEquals( new Integer( 10 ), node.getValue( context, root ) );
     }
 
-    public void test_Set_Get_Multiple_Generic_Types_Property() throws Exception
+    public void test_Set_Get_Multiple_Generic_Types_Property()
+        throws Exception
     {
         BaseGeneric<GameGenericObject, Long> root = new GameGeneric();
-        OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
 
-        context.setRoot(root);
-        context.setCurrentObject(root);
+        context.setRoot( root );
+        context.setCurrentObject( root );
 
-        SimpleNode node = (SimpleNode) Ognl.parseExpression("ids");
-        node.setValue(context, root, new String[] {"0", "20", "43"});
+        SimpleNode node = (SimpleNode) Ognl.parseExpression( "ids" );
+        node.setValue( context, root, new String[] { "0", "20", "43" } );
 
-        isEqual(new Long[] {new Long(0), new Long(20), new Long(43)}, root.getIds());
-        isEqual(node.getValue(context, root), root.getIds());
+        isEqual( new Long[] { new Long( 0 ), new Long( 20 ), new Long( 43 ) }, root.getIds() );
+        isEqual( node.getValue( context, root ), root.getIds() );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArithmeticAndLogicalOperatorsTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArithmeticAndLogicalOperatorsTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArithmeticAndLogicalOperatorsTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArithmeticAndLogicalOperatorsTest.java Sat May 14 13:18:29 2011
@@ -23,132 +23,113 @@ import junit.framework.TestSuite;
 
 import java.math.BigDecimal;
 
-public class ArithmeticAndLogicalOperatorsTest extends OgnlTestCase
+public class ArithmeticAndLogicalOperatorsTest
+    extends OgnlTestCase
 {
 
     private static Object[][] TESTS = {
-            // Double-valued arithmetic expressions
-            { "-1d", new Double(-1) },
-            { "+1d", new Double(1) },
-            { "--1f", new Double(1) },
-            { "2*2.0", new Double(4.0) },
-            { "5/2.", new Double(2.5) },
-            { "5+2D", new Double(7) },
-            { "5f-2F", new Double(3.0) },
-            { "5.+2*3", new Double(11) },
-            { "(5.+2)*3", new Double(21) },
-
-            // BigDecimal-valued arithmetic expressions
-            { "-1b", new Integer(-1) },
-            { "+1b", new Integer(1) },
-            { "--1b", new Integer(1) },
-            { "2*2.0b", new Double(4.0) }, 
-            { "5/2.B", new Integer(2) },
-            { "5.0B/2", new Double(2.5) },
-            { "5+2b", new Integer(7) },
-            { "5-2B", new Integer(3) },
-            { "5.+2b*3", new Double(11) },
-            { "(5.+2b)*3", new Double(21) },
-
-            // Integer-valued arithmetic expressions
-            { "-1", new Integer(-1) },
-            { "+1", new Integer(1) },
-            { "--1", new Integer(1) },
-            { "2*2", new Integer(4) },
-            { "5/2", new Integer(2) },
-            { "5+2", new Integer(7) },
-            { "5-2", new Integer(3) },
-            { "5+2*3", new Integer(11) },
-            { "(5+2)*3", new Integer(21) },
-            { "~1", new Integer(~1) },
-            { "5%2", new Integer(1) },
-            { "5<<2", new Integer(20) },
-            { "5>>2", new Integer(1) },
-            { "5>>1+1", new Integer(1) },
-            { "-5>>>2", new Integer(-5 >>> 2)},
-            { "-5L>>>2", new Long(-5L >>> 2) },
-            { "5. & 3", new Long(1) },
-            { "5 ^3", new Integer(6) },
-            { "5l&3|5^3", new Long(7) },
-            { "5&(3|5^3)", new Long(5) },
-            { "true ? 1 : 1/0", new Integer(1) },
-
-            // BigInteger-valued arithmetic expressions
-            { "-1h", Integer.valueOf(-1) },
-            { "+1H", Integer.valueOf(1) },
-            { "--1h", Integer.valueOf(1) },
-            { "2h*2", Integer.valueOf(4) },
-            { "5/2h", Integer.valueOf(2) },
-            { "5h+2", Integer.valueOf(7) },
-            { "5-2h", Integer.valueOf(3) },
-            { "5+2H*3", Integer.valueOf(11) },
-            { "(5+2H)*3", Integer.valueOf(21) },
-            { "~1h", Integer.valueOf(~1) },
-            { "5h%2", Integer.valueOf(1) },
-            { "5h<<2", Integer.valueOf(20) },
-            { "5h>>2", Integer.valueOf(1) },
-            { "5h>>1+1", Integer.valueOf(1) },
-            { "-5h>>>2", Integer.valueOf(-2) },
-            { "5.b & 3", new Long(1) },
-            { "5h ^3", Integer.valueOf(6) },
-            { "5h&3|5^3", new Long(7) },
-            { "5H&(3|5^3)", new Long(5) },
-
-            // Logical expressions
-            { "!1", Boolean.FALSE },
-            { "!null", Boolean.TRUE },
-            { "5<2", Boolean.FALSE },
-            { "5>2", Boolean.TRUE },
-            { "5<=5", Boolean.TRUE },
-            { "5>=3", Boolean.TRUE },
-            { "5<-5>>>2", Boolean.TRUE },
-            { "5==5.0", Boolean.TRUE },
-            { "5!=5.0", Boolean.FALSE },
-            { "null in {true,false,null}", Boolean.TRUE },
-            { "null not in {true,false,null}", Boolean.FALSE },
-            { "null in {true,false,null}.toArray()", Boolean.TRUE },
-            { "5 in {true,false,null}", Boolean.FALSE },
-            { "5 not in {true,false,null}", Boolean.TRUE },
-            { "5 instanceof java.lang.Integer", Boolean.TRUE },
-            { "5. instanceof java.lang.Integer", Boolean.FALSE },
-            { "!false || true", Boolean.TRUE},
-            { "!(true && true)", Boolean.FALSE},
-            { "(1 > 0 && true) || 2 > 0", Boolean.TRUE},
-
-            // Logical expressions (string versions)
-            { "2 or 0", Integer.valueOf(2)},
-            { "1 and 0", Integer.valueOf(0) },
-            { "1 bor 0", new Integer(1) },
-            { "true && 12", Integer.valueOf(12)},
-            { "1 xor 0", new Integer(1) }, { "1 band 0", new Long(0) }, { "1 eq 1", Boolean.TRUE },
-            { "1 neq 1", Boolean.FALSE }, { "1 lt 5", Boolean.TRUE }, { "1 lte 5", Boolean.TRUE },
-            { "1 gt 5", Boolean.FALSE }, { "1 gte 5", Boolean.FALSE }, { "1 lt 5", Boolean.TRUE },
-            { "1 shl 2", new Integer(4) }, { "4 shr 2", new Integer(1) }, { "4 ushr 2", new Integer(1) },
-            { "not null", Boolean.TRUE }, { "not 1", Boolean.FALSE },
-
-            { "#x > 0", Boolean.TRUE },
-            { "#x < 0", Boolean.FALSE },
-            { "#x == 0", Boolean.FALSE },
-            { "#x == 1", Boolean.TRUE },
-            { "0 > #x", Boolean.FALSE },
-            { "0 < #x", Boolean.TRUE },
-            { "0 == #x", Boolean.FALSE },
-            { "1 == #x", Boolean.TRUE },
-            { "\"1\" > 0", Boolean.TRUE },
-            { "\"1\" < 0", Boolean.FALSE },
-            { "\"1\" == 0", Boolean.FALSE },
-            { "\"1\" == 1", Boolean.TRUE },
-            { "0 > \"1\"", Boolean.FALSE },
-            { "0 < \"1\"", Boolean.TRUE },
-            { "0 == \"1\"", Boolean.FALSE },
-            { "1 == \"1\"", Boolean.TRUE },
-            { "#x + 1", "11" },
-            { "1 + #x", "11" },
-            { "#y == 1", Boolean.TRUE },
-            { "#y == \"1\"", Boolean.TRUE },
-            { "#y + \"1\"", "11" },
-            { "\"1\" + #y", "11" }
-    };
+        // Double-valued arithmetic expressions
+        { "-1d", new Double( -1 ) },
+        { "+1d", new Double( 1 ) },
+        { "--1f", new Double( 1 ) },
+        { "2*2.0", new Double( 4.0 ) },
+        { "5/2.", new Double( 2.5 ) },
+        { "5+2D", new Double( 7 ) },
+        { "5f-2F", new Double( 3.0 ) },
+        { "5.+2*3", new Double( 11 ) },
+        { "(5.+2)*3", new Double( 21 ) },
+
+        // BigDecimal-valued arithmetic expressions
+        { "-1b", new Integer( -1 ) },
+        { "+1b", new Integer( 1 ) },
+        { "--1b", new Integer( 1 ) },
+        { "2*2.0b", new Double( 4.0 ) },
+        { "5/2.B", new Integer( 2 ) },
+        { "5.0B/2", new Double( 2.5 ) },
+        { "5+2b", new Integer( 7 ) },
+        { "5-2B", new Integer( 3 ) },
+        { "5.+2b*3", new Double( 11 ) },
+        { "(5.+2b)*3", new Double( 21 ) },
+
+        // Integer-valued arithmetic expressions
+        { "-1", new Integer( -1 ) },
+        { "+1", new Integer( 1 ) },
+        { "--1", new Integer( 1 ) },
+        { "2*2", new Integer( 4 ) },
+        { "5/2", new Integer( 2 ) },
+        { "5+2", new Integer( 7 ) },
+        { "5-2", new Integer( 3 ) },
+        { "5+2*3", new Integer( 11 ) },
+        { "(5+2)*3", new Integer( 21 ) },
+        { "~1", new Integer( ~1 ) },
+        { "5%2", new Integer( 1 ) },
+        { "5<<2", new Integer( 20 ) },
+        { "5>>2", new Integer( 1 ) },
+        { "5>>1+1", new Integer( 1 ) },
+        { "-5>>>2", new Integer( -5 >>> 2 ) },
+        { "-5L>>>2", new Long( -5L >>> 2 ) },
+        { "5. & 3", new Long( 1 ) },
+        { "5 ^3", new Integer( 6 ) },
+        { "5l&3|5^3", new Long( 7 ) },
+        { "5&(3|5^3)", new Long( 5 ) },
+        { "true ? 1 : 1/0", new Integer( 1 ) },
+
+        // BigInteger-valued arithmetic expressions
+        { "-1h", Integer.valueOf( -1 ) },
+        { "+1H", Integer.valueOf( 1 ) },
+        { "--1h", Integer.valueOf( 1 ) },
+        { "2h*2", Integer.valueOf( 4 ) },
+        { "5/2h", Integer.valueOf( 2 ) },
+        { "5h+2", Integer.valueOf( 7 ) },
+        { "5-2h", Integer.valueOf( 3 ) },
+        { "5+2H*3", Integer.valueOf( 11 ) },
+        { "(5+2H)*3", Integer.valueOf( 21 ) },
+        { "~1h", Integer.valueOf( ~1 ) },
+        { "5h%2", Integer.valueOf( 1 ) },
+        { "5h<<2", Integer.valueOf( 20 ) },
+        { "5h>>2", Integer.valueOf( 1 ) },
+        { "5h>>1+1", Integer.valueOf( 1 ) },
+        { "-5h>>>2", Integer.valueOf( -2 ) },
+        { "5.b & 3", new Long( 1 ) },
+        { "5h ^3", Integer.valueOf( 6 ) },
+        { "5h&3|5^3", new Long( 7 ) },
+        { "5H&(3|5^3)", new Long( 5 ) },
+
+        // Logical expressions
+        { "!1", Boolean.FALSE }, { "!null", Boolean.TRUE },
+        { "5<2", Boolean.FALSE },
+        { "5>2", Boolean.TRUE },
+        { "5<=5", Boolean.TRUE },
+        { "5>=3", Boolean.TRUE },
+        { "5<-5>>>2", Boolean.TRUE },
+        { "5==5.0", Boolean.TRUE },
+        { "5!=5.0", Boolean.FALSE },
+        { "null in {true,false,null}", Boolean.TRUE },
+        { "null not in {true,false,null}", Boolean.FALSE },
+        { "null in {true,false,null}.toArray()", Boolean.TRUE },
+        { "5 in {true,false,null}", Boolean.FALSE },
+        { "5 not in {true,false,null}", Boolean.TRUE },
+        { "5 instanceof java.lang.Integer", Boolean.TRUE },
+        { "5. instanceof java.lang.Integer", Boolean.FALSE },
+        { "!false || true", Boolean.TRUE },
+        { "!(true && true)", Boolean.FALSE },
+        { "(1 > 0 && true) || 2 > 0", Boolean.TRUE },
+
+        // Logical expressions (string versions)
+        { "2 or 0", Integer.valueOf( 2 ) }, { "1 and 0", Integer.valueOf( 0 ) }, { "1 bor 0", new Integer( 1 ) },
+        { "true && 12", Integer.valueOf( 12 ) }, { "1 xor 0", new Integer( 1 ) }, { "1 band 0", new Long( 0 ) },
+        { "1 eq 1", Boolean.TRUE }, { "1 neq 1", Boolean.FALSE }, { "1 lt 5", Boolean.TRUE },
+        { "1 lte 5", Boolean.TRUE }, { "1 gt 5", Boolean.FALSE }, { "1 gte 5", Boolean.FALSE },
+        { "1 lt 5", Boolean.TRUE }, { "1 shl 2", new Integer( 4 ) }, { "4 shr 2", new Integer( 1 ) },
+        { "4 ushr 2", new Integer( 1 ) }, { "not null", Boolean.TRUE }, { "not 1", Boolean.FALSE },
+
+        { "#x > 0", Boolean.TRUE }, { "#x < 0", Boolean.FALSE }, { "#x == 0", Boolean.FALSE },
+        { "#x == 1", Boolean.TRUE }, { "0 > #x", Boolean.FALSE }, { "0 < #x", Boolean.TRUE },
+        { "0 == #x", Boolean.FALSE }, { "1 == #x", Boolean.TRUE }, { "\"1\" > 0", Boolean.TRUE },
+        { "\"1\" < 0", Boolean.FALSE }, { "\"1\" == 0", Boolean.FALSE }, { "\"1\" == 1", Boolean.TRUE },
+        { "0 > \"1\"", Boolean.FALSE }, { "0 < \"1\"", Boolean.TRUE }, { "0 == \"1\"", Boolean.FALSE },
+        { "1 == \"1\"", Boolean.TRUE }, { "#x + 1", "11" }, { "1 + #x", "11" }, { "#y == 1", Boolean.TRUE },
+        { "#y == \"1\"", Boolean.TRUE }, { "#y + \"1\"", "11" }, { "\"1\" + #y", "11" } };
 
     /*
      * =================================================================== Public static methods
@@ -158,9 +139,10 @@ public class ArithmeticAndLogicalOperato
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            result.addTest(new ArithmeticAndLogicalOperatorsTest((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 ArithmeticAndLogicalOperatorsTest( (String) TESTS[i][0] + " (" + TESTS[i][1] + ")",
+                                                                   null, (String) TESTS[i][0], TESTS[i][1] ) );
         }
         return result;
     }
@@ -174,26 +156,26 @@ public class ArithmeticAndLogicalOperato
         super();
     }
 
-    public ArithmeticAndLogicalOperatorsTest(String name)
+    public ArithmeticAndLogicalOperatorsTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ArithmeticAndLogicalOperatorsTest(String name, Object root, String expressionString, Object expectedResult,
-                                             Object setValue, Object expectedAfterSetResult)
+    public ArithmeticAndLogicalOperatorsTest( 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 ArithmeticAndLogicalOperatorsTest(String name, Object root, String expressionString, Object expectedResult,
-                                             Object setValue)
+    public ArithmeticAndLogicalOperatorsTest( String name, Object root, String expressionString, Object expectedResult,
+                                              Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ArithmeticAndLogicalOperatorsTest(String name, Object root, String expressionString, Object expectedResult)
+    public ArithmeticAndLogicalOperatorsTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     /*
@@ -203,7 +185,7 @@ public class ArithmeticAndLogicalOperato
     protected void setUp()
     {
         super.setUp();
-        _context.put("x", "1");
-        _context.put("y", new BigDecimal(1));
+        _context.put( "x", "1" );
+        _context.put( "y", new BigDecimal( 1 ) );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayCreationTest.java Sat May 14 13:18:29 2011
@@ -25,31 +25,35 @@ import org.apache.commons.ognl.test.obje
 import org.apache.commons.ognl.test.objects.Root;
 import org.apache.commons.ognl.test.objects.Simple;
 
-public class ArrayCreationTest extends OgnlTestCase
+public class ArrayCreationTest
+    extends OgnlTestCase
 {
 
     private static Root ROOT = new Root();
 
-    private static Object[][] TESTS = {
+    private static Object[][] TESTS =
+        {
             // Array creation
             { ROOT, "new String[] { \"one\", \"two\" }", new String[] { "one", "two" } },
             { ROOT, "new String[] { 1, 2 }", new String[] { "1", "2" } },
             { ROOT, "new Integer[] { \"1\", 2, \"3\" }",
-              new Integer[] { new Integer(1), new Integer(2), new Integer(3) } },
+                new Integer[] { new Integer( 1 ), new Integer( 2 ), new Integer( 3 ) } },
             { ROOT, "new String[10]", new String[10] },
             { ROOT, "new Object[4] { #root, #this }", ExpressionSyntaxException.class },
             { ROOT, "new Object[4]", new Object[4] },
             { ROOT, "new Object[] { #root, #this }", new Object[] { ROOT, ROOT } },
-            { ROOT,
-              "new org.apache.commons.ognl.test.objects.Simple[] { new org.apache.commons.ognl.test.objects.Simple(), new org.apache.commons.ognl.test.objects.Simple(\"foo\", 1.0f, 2) }",
-              new Simple[] { new Simple(), new Simple("foo", 1.0f, 2) } },
+            {
+                ROOT,
+                "new org.apache.commons.ognl.test.objects.Simple[] { new org.apache.commons.ognl.test.objects.Simple(), new org.apache.commons.ognl.test.objects.Simple(\"foo\", 1.0f, 2) }",
+                new Simple[] { new Simple(), new Simple( "foo", 1.0f, 2 ) } },
             { ROOT, "new org.apache.commons.ognl.test.objects.Simple[5]", new Simple[5] },
-            { ROOT, "new org.apache.commons.ognl.test.objects.Simple(new Object[5])", new Simple(new Object[5]) },
-            { ROOT, "new org.apache.commons.ognl.test.objects.Simple(new String[5])", new Simple(new String[5]) },
-            { ROOT, "objectIndex ? new org.apache.commons.ognl.test.objects.Entry[] { new org.apache.commons.ognl.test.objects.Entry(), new org.apache.commons.ognl.test.objects.Entry()} "
+            { ROOT, "new org.apache.commons.ognl.test.objects.Simple(new Object[5])", new Simple( new Object[5] ) },
+            { ROOT, "new org.apache.commons.ognl.test.objects.Simple(new String[5])", new Simple( new String[5] ) },
+            {
+                ROOT,
+                "objectIndex ? new org.apache.commons.ognl.test.objects.Entry[] { new org.apache.commons.ognl.test.objects.Entry(), new org.apache.commons.ognl.test.objects.Entry()} "
                     + ": new org.apache.commons.ognl.test.objects.Entry[] { new org.apache.commons.ognl.test.objects.Entry(), new org.apache.commons.ognl.test.objects.Entry()} ",
-              new Entry[] { new Entry(), new Entry()} }
-    };
+                new Entry[] { new Entry(), new Entry() } } };
 
     /*
      * =================================================================== Public static methods
@@ -59,20 +63,30 @@ public class ArrayCreationTest extends O
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new ArrayCreationTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                                     TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new ArrayCreationTest((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 ArrayCreationTest((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 ArrayCreationTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                       TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new ArrayCreationTest( (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 ArrayCreationTest( (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" );
                     }
                 }
             }
@@ -89,24 +103,24 @@ public class ArrayCreationTest extends O
         super();
     }
 
-    public ArrayCreationTest(String name)
+    public ArrayCreationTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ArrayCreationTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                             Object expectedAfterSetResult)
+    public ArrayCreationTest( 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 ArrayCreationTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public ArrayCreationTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ArrayCreationTest(String name, Object root, String expressionString, Object expectedResult)
+    public ArrayCreationTest( 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/ArrayElementsTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ArrayElementsTest.java Sat May 14 13:18:29 2011
@@ -25,31 +25,35 @@ import org.apache.commons.ognl.test.obje
 
 import java.util.Arrays;
 
-public class ArrayElementsTest extends OgnlTestCase {
+public class ArrayElementsTest
+    extends OgnlTestCase
+{
+
+    private static String[] STRING_ARRAY = new String[] { "hello", "world" };
+
+    private static int[] INT_ARRAY = new int[] { 10, 20 };
 
-    private static String[] STRING_ARRAY = new String[]{"hello", "world"};
-    private static int[] INT_ARRAY = new int[]{10, 20};
     private static Root ROOT = new Root();
 
     private static Object[][] TESTS = {
-            // Array elements test
-            {STRING_ARRAY, "length", new Integer(2)},
-            {STRING_ARRAY, "#root[1]", "world"},
-            {INT_ARRAY, "#root[1]", new Integer(20)},
-            {INT_ARRAY, "#root[1]", new Integer(20), "50", new Integer(50)},
-            {INT_ARRAY, "#root[1]", new Integer(50), new String[]{"50", "100"}, new Integer(50)},
-            {ROOT, "intValue", new Integer(0), new String[]{"50", "100"}, new Integer(50)},
-            {ROOT, "array", ROOT.getArray(), new String[]{"50", "100"}, new int[]{50, 100}},
-            {null, "\"{Hello}\".toCharArray()[6]", new Character('}')},
-            {null, "\"Tapestry\".toCharArray()[2]", new Character('p')},
-            {null, "{'1','2','3'}", Arrays.asList(new Object[]{new Character('1'), new Character('2'), new Character('3')})},
-            {null, "{ true, !false }", Arrays.asList(new Boolean[] { Boolean.TRUE, Boolean.TRUE }) }
-    };
+        // Array elements test
+        { STRING_ARRAY, "length", new Integer( 2 ) },
+        { STRING_ARRAY, "#root[1]", "world" },
+        { INT_ARRAY, "#root[1]", new Integer( 20 ) },
+        { INT_ARRAY, "#root[1]", new Integer( 20 ), "50", new Integer( 50 ) },
+        { INT_ARRAY, "#root[1]", new Integer( 50 ), new String[] { "50", "100" }, new Integer( 50 ) },
+        { ROOT, "intValue", new Integer( 0 ), new String[] { "50", "100" }, new Integer( 50 ) },
+        { ROOT, "array", ROOT.getArray(), new String[] { "50", "100" }, new int[] { 50, 100 } },
+        { null, "\"{Hello}\".toCharArray()[6]", new Character( '}' ) },
+        { null, "\"Tapestry\".toCharArray()[2]", new Character( 'p' ) },
+        { null, "{'1','2','3'}",
+            Arrays.asList( new Object[] { new Character( '1' ), new Character( '2' ), new Character( '3' ) } ) },
+        { null, "{ true, !false }", Arrays.asList( new Boolean[] { Boolean.TRUE, Boolean.TRUE } ) } };
 
     /*
-    * =================================================================== Private static methods
-    * ===================================================================
-    */
+     * =================================================================== Private static methods
+     * ===================================================================
+     */
     /*
      * =================================================================== Public static methods
      * ===================================================================
@@ -58,20 +62,30 @@ public class ArrayElementsTest extends O
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new ArrayElementsTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                                     TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new ArrayElementsTest((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 ArrayElementsTest((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 ArrayElementsTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                       TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new ArrayElementsTest( (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 ArrayElementsTest( (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" );
                     }
                 }
             }
@@ -88,25 +102,25 @@ public class ArrayElementsTest extends O
         super();
     }
 
-    public ArrayElementsTest(String name)
+    public ArrayElementsTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ArrayElementsTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                             Object expectedAfterSetResult)
+    public ArrayElementsTest( 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 ArrayElementsTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public ArrayElementsTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ArrayElementsTest(String name, Object root, String expressionString, Object expectedResult)
+    public ArrayElementsTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     /*
@@ -119,19 +133,10 @@ public class ArrayElementsTest extends O
 
         super.setUp();
         /**
-         arrayConverter = new DefaultTypeConverter() {
-
-         public Object convertValue(Map context, Object target, Member member, String propertyName, Object value,
-         Class toType)
-         {
-         if (value.getClass().isArray()) {
-         if (!toType.isArray()) {
-         value = Array.get(value, 0);
-         }
-         }
-         return super.convertValue(context, target, member, propertyName, value, toType);
-         }
-         };
-         _context.setTypeConverter(arrayConverter); */
+         * arrayConverter = new DefaultTypeConverter() { public Object convertValue(Map context, Object target, Member
+         * member, String propertyName, Object value, Class toType) { if (value.getClass().isArray()) { if
+         * (!toType.isArray()) { value = Array.get(value, 0); } } return super.convertValue(context, target, member,
+         * propertyName, value, toType); } }; _context.setTypeConverter(arrayConverter);
+         */
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ClassMethodTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ClassMethodTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ClassMethodTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ClassMethodTest.java Sat May 14 13:18:29 2011
@@ -22,20 +22,20 @@ package org.apache.commons.ognl.test;
 import junit.framework.TestSuite;
 import org.apache.commons.ognl.test.objects.CorrectedObject;
 
-public class ClassMethodTest extends OgnlTestCase
+public class ClassMethodTest
+    extends OgnlTestCase
 {
 
     private static CorrectedObject CORRECTED = new CorrectedObject();
 
     private static Object[][] TESTS = {
-            // Methods on Class
-            { CORRECTED, "getClass().getName()", CORRECTED.getClass().getName() },
-            { CORRECTED, "getClass().getInterfaces()", CORRECTED.getClass().getInterfaces() },
-            { CORRECTED, "getClass().getInterfaces().length", new Integer(CORRECTED.getClass().getInterfaces().length) },
-            { null, "@System@class.getInterfaces()", System.class.getInterfaces() },
-            { null, "@Class@class.getName()", Class.class.getName() },
-            { null, "@java.awt.image.ImageObserver@class.getName()", java.awt.image.ImageObserver.class.getName() },
-    };
+        // Methods on Class
+        { CORRECTED, "getClass().getName()", CORRECTED.getClass().getName() },
+        { CORRECTED, "getClass().getInterfaces()", CORRECTED.getClass().getInterfaces() },
+        { CORRECTED, "getClass().getInterfaces().length", new Integer( CORRECTED.getClass().getInterfaces().length ) },
+        { null, "@System@class.getInterfaces()", System.class.getInterfaces() },
+        { null, "@Class@class.getName()", Class.class.getName() },
+        { null, "@java.awt.image.ImageObserver@class.getName()", java.awt.image.ImageObserver.class.getName() }, };
 
     /*
      * =================================================================== Public static methods
@@ -45,8 +45,9 @@ public class ClassMethodTest extends Ogn
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            result.addTest(new ClassMethodTest((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 ClassMethodTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2] ) );
         }
         return result;
     }
@@ -60,24 +61,24 @@ public class ClassMethodTest extends Ogn
         super();
     }
 
-    public ClassMethodTest(String name)
+    public ClassMethodTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ClassMethodTest(String name, Object root, String expressionString, Object expectedResult, Object setValue,
-                           Object expectedAfterSetResult)
+    public ClassMethodTest( 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 ClassMethodTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public ClassMethodTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ClassMethodTest(String name, Object root, String expressionString, Object expectedResult)
+    public ClassMethodTest( 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/CollectionDirectPropertyTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java Sat May 14 13:18:29 2011
@@ -24,30 +24,29 @@ import org.apache.commons.ognl.test.obje
 
 import java.util.Arrays;
 
-public class CollectionDirectPropertyTest extends OgnlTestCase {
+public class CollectionDirectPropertyTest
+    extends OgnlTestCase
+{
 
     private static Root ROOT = new Root();
 
     private static Object[][] TESTS = {
-            // Collection direct properties
-            {Arrays.asList(new String[]{"hello", "world"}), "size", new Integer(2)},
-            {Arrays.asList(new String[]{"hello", "world"}), "isEmpty", Boolean.FALSE},
-            {Arrays.asList(new String[]{}), "isEmpty", Boolean.TRUE},
-            {Arrays.asList(new String[]{"hello", "world"}), "iterator.next", "hello"},
-            {Arrays.asList(new String[]{"hello", "world"}), "iterator.hasNext", Boolean.TRUE},
-            {Arrays.asList(new String[]{"hello", "world"}), "#it = iterator, #it.next, #it.next, #it.hasNext",
-                    Boolean.FALSE},
-            {Arrays.asList(new String[]{"hello", "world"}), "#it = iterator, #it.next, #it.next", "world"},
-            {Arrays.asList(new String[]{"hello", "world"}), "size", new Integer(2)},
-            {ROOT, "map[\"test\"]", ROOT},
-            {ROOT, "map.size", new Integer(ROOT.getMap().size())},
-            {ROOT, "map.keySet", ROOT.getMap().keySet()},
-            {ROOT, "map.values", ROOT.getMap().values()},
-            {ROOT, "map.keys.size", new Integer(ROOT.getMap().keySet().size())},
-            {ROOT, "map[\"size\"]", ROOT.getMap().get("size")},
-            {ROOT, "map.isEmpty", ROOT.getMap().isEmpty() ? Boolean.TRUE : Boolean.FALSE},
-            {ROOT, "map[\"isEmpty\"]", null},
-    };
+        // Collection direct properties
+        { Arrays.asList( new String[] { "hello", "world" } ), "size", new Integer( 2 ) },
+        { Arrays.asList( new String[] { "hello", "world" } ), "isEmpty", Boolean.FALSE },
+        { Arrays.asList( new String[] {} ), "isEmpty", Boolean.TRUE },
+        { Arrays.asList( new String[] { "hello", "world" } ), "iterator.next", "hello" },
+        { Arrays.asList( new String[] { "hello", "world" } ), "iterator.hasNext", Boolean.TRUE },
+        { Arrays.asList( new String[] { "hello", "world" } ), "#it = iterator, #it.next, #it.next, #it.hasNext",
+            Boolean.FALSE },
+        { Arrays.asList( new String[] { "hello", "world" } ), "#it = iterator, #it.next, #it.next", "world" },
+        { Arrays.asList( new String[] { "hello", "world" } ), "size", new Integer( 2 ) },
+        { ROOT, "map[\"test\"]", ROOT }, { ROOT, "map.size", new Integer( ROOT.getMap().size() ) },
+        { ROOT, "map.keySet", ROOT.getMap().keySet() }, { ROOT, "map.values", ROOT.getMap().values() },
+        { ROOT, "map.keys.size", new Integer( ROOT.getMap().keySet().size() ) },
+        { ROOT, "map[\"size\"]", ROOT.getMap().get( "size" ) },
+        { ROOT, "map.isEmpty", ROOT.getMap().isEmpty() ? Boolean.TRUE : Boolean.FALSE },
+        { ROOT, "map[\"isEmpty\"]", null }, };
 
     /*
      * =================================================================== Public static methods
@@ -57,20 +56,31 @@ public class CollectionDirectPropertyTes
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new CollectionDirectPropertyTest((String) TESTS[i][1], TESTS[i][0],
-                        (String) TESTS[i][1], TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new CollectionDirectPropertyTest((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 CollectionDirectPropertyTest((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 CollectionDirectPropertyTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                  (String) TESTS[i][1], TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new CollectionDirectPropertyTest( (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 CollectionDirectPropertyTest( (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" );
                     }
                 }
             }
@@ -87,25 +97,25 @@ public class CollectionDirectPropertyTes
         super();
     }
 
-    public CollectionDirectPropertyTest(String name)
+    public CollectionDirectPropertyTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public CollectionDirectPropertyTest(String name, Object root, String expressionString, Object expectedResult,
-                                        Object setValue, Object expectedAfterSetResult)
+    public CollectionDirectPropertyTest( 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 CollectionDirectPropertyTest(String name, Object root, String expressionString, Object expectedResult,
-                                        Object setValue)
+    public CollectionDirectPropertyTest( String name, Object root, String expressionString, Object expectedResult,
+                                         Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public CollectionDirectPropertyTest(String name, Object root, String expressionString, Object expectedResult)
+    public CollectionDirectPropertyTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }