commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1300952 - in /commons/sandbox/beanutils2/trunk/src: changes/ test/java/org/apache/commons/beanutils2/
Date Thu, 15 Mar 2012 12:24:52 GMT
Author: simonetripodi
Date: Thu Mar 15 12:24:52 2012
New Revision: 1300952

URL: http://svn.apache.org/viewvc?rev=1300952&view=rev
Log:
[SANDBOX-403] Refactor Unit tests for better readability - patch provided by Benedikt Ritter

Added:
    commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
  (with props)
Modified:
    commons/sandbox/beanutils2/trunk/src/changes/changes.xml
    commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CloneTestCase.java
    commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PopulateTestCase.java

Modified: commons/sandbox/beanutils2/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/changes/changes.xml?rev=1300952&r1=1300951&r2=1300952&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/changes/changes.xml (original)
+++ commons/sandbox/beanutils2/trunk/src/changes/changes.xml Thu Mar 15 12:24:52 2012
@@ -23,6 +23,9 @@
   </properties>
   <body>
   <release version="0.1" date="201?-??-??" description="First release.">
+    <action dev="simonetripodi" type="add" issue="SANDBOX-403" due-to="Benedikt Ritter">
+      Refactor Unit tests for better readability
+    </action>
     <action dev="simonetripodi" type="add" issue="SANDBOX-401" due-to="Benedikt Ritter">
       Performance improvement: store hash code of AccessibleObjectDescriptor as member variable
     </action>

Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CloneTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CloneTestCase.java?rev=1300952&r1=1300951&r2=1300952&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CloneTestCase.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CloneTestCase.java
Thu Mar 15 12:24:52 2012
@@ -18,10 +18,12 @@ package org.apache.commons.beanutils2;
  */
 
 import static org.apache.commons.beanutils2.BeanUtils.on;
-import static org.junit.Assert.assertArrayEquals;
+import static org.apache.commons.beanutils2.TestBeanUtils.assertReadWritePropertiesEquals;
+import static org.apache.commons.beanutils2.TestBeanUtils.assertShallow;
+import static org.apache.commons.beanutils2.TestBeanUtils.changeArrayProperties;
+import static org.apache.commons.beanutils2.TestBeanUtils.changeScalarProperties;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 import org.junit.After;
 import org.junit.Before;
@@ -31,6 +33,7 @@ public class CloneTestCase
 {
 
     private TestBean original;
+    private TestBean defaults;
 
     private TestBean clone;
 
@@ -38,12 +41,14 @@ public class CloneTestCase
     public void setUp()
     {
         original = new TestBean();
+        defaults = new TestBean();
     }
 
     @After
     public void tearDown()
     {
         original = null;
+        defaults = null;
         clone = null;
     }
 
@@ -51,16 +56,17 @@ public class CloneTestCase
     public void cloneTestBean()
         throws Exception
     {
-        clone = on( new TestBean() ).cloneBean();
+        clone = on( defaults ).cloneBean();
         assertNotNull( "Clone is null!", clone );
-        assertReadWritePropertiesEquals( new TestBean(), clone );
+        // we can not simply call assertEquals because of the nested properties in TestBean
+        assertReadWritePropertiesEquals( defaults, clone );
     }
 
     @Test
     public void cloneWithChangedScalarProperties()
         throws Exception
     {
-        changeScalarProperties();
+        changeScalarProperties( original );
 
         clone = on( original ).cloneBean();
         assertNotNull( "Clone is null!", clone );
@@ -68,40 +74,17 @@ public class CloneTestCase
         assertReadWritePropertiesEquals( original, clone );
     }
 
-    private void changeScalarProperties()
-    {
-        original.setBooleanProperty( false );
-        // booleanSecond is left at true
-        original.setByteProperty( (byte) 111 );
-        original.setDoubleProperty( 432.0 );
-        // floatProperty is left at 123.0
-        original.setIntProperty( 543 );
-        original.setLongProperty( 123456789l );
-        original.setNullProperty( "Non-null value" );
-        original.setShortProperty( (short) 654 );
-        // stringProperty is left at "This is a string"
-    }
-
     @Test
     public void cloneWithChangedArrayProperties()
         throws Exception
     {
-        changeArrayProperties();
+        changeArrayProperties( original );
 
         clone = on( original ).cloneBean();
         assertNotNull( clone );
-
         assertReadWritePropertiesEquals( original, clone );
     }
 
-    private void changeArrayProperties()
-    {
-        int intArray[] = new int[] { 123, 456, 789 };
-        String stringArray[] = new String[] { "New String 0", "New String 1" };
-        original.setIntArray( intArray );
-        original.setStringArray( stringArray );
-    }
-
     @Test
     public void cloneWithChangedWriteOnlyProperty()
         throws Exception
@@ -114,7 +97,7 @@ public class CloneTestCase
 
         // The value of writeOnlyProperty can not be read out from original, so it must have
the
         // original value
-        assertEquals( "writeOnlyProperty has been changed on clone!", new TestBean().getWriteOnlyPropertyValue(),
+        assertEquals( "writeOnlyProperty has been changed on clone!", defaults.getWriteOnlyPropertyValue(),
                       clone.getWriteOnlyPropertyValue() );
     }
 
@@ -127,52 +110,6 @@ public class CloneTestCase
     {
         clone = on( original ).cloneBean();
 
-        assertTrue(clone.getAnotherNested() == original.getAnotherNested());
-        assertTrue(clone.getDateArrayProperty() == original.getDateArrayProperty());
-        assertTrue(clone.getDateProperty() == original.getDateProperty());
-        assertTrue(clone.getDateProperty() == original.getDateProperty());
-        assertTrue(clone.getDupProperty() == original.getDupProperty());
-        assertTrue(clone.getIntArray() == original.getIntArray());
-        assertTrue(clone.getMapProperty() == original.getMapProperty());
-        assertTrue(clone.getStringArray() == original.getStringArray());
-        assertTrue(clone.getStringProperty() == original.getStringProperty());
+        assertShallow( original, clone );
     }
-
-    /**
-     * Asserts that all properties that are readable and writable on {@code actual} are equal
to those on
-     * {@code expected}.
-     *
-     * @param expected the {@code TestBean} with the expected properties.
-     * @param actual the {@code TestBean} with the actual values.
-     */
-    private static void assertReadWritePropertiesEquals( TestBean expected, TestBean actual
)
-    {
-        assertEquals( "Property 'anotherNested' is not equal!", expected.getAnotherNested(),
actual.getAnotherNested() );
-        assertEquals( "Property 'booleanProperty' is not equal!", expected.getBooleanProperty(),
-                      actual.getBooleanProperty() );
-        assertEquals( "Property 'booleanSecond' is not equal!", expected.isBooleanSecond(),
actual.isBooleanSecond() );
-        assertEquals( "Property 'byteProperty' is not equal!", expected.getByteProperty(),
actual.getByteProperty() );
-        assertArrayEquals( "Property 'DateArrayProperty' is not equal!", expected.getDateArrayProperty(),
-                           actual.getDateArrayProperty() );
-        assertEquals( "Property 'dateProperty' is not equal!", expected.getDateProperty(),
actual.getDateProperty() );
-        assertEquals( "Property 'doubleProperty' is not equal!", expected.getDoubleProperty(),
-                      actual.getDoubleProperty(), 0.0 );
-        assertArrayEquals( "Property 'dupProperty' is not equal!", expected.getDupProperty(),
actual.getDupProperty() );
-        assertEquals( "Property 'floatProperty' is not equal!", expected.getFloatProperty(),
actual.getFloatProperty(),
-                      0.0 );
-        assertArrayEquals( "Property 'intArrayProperty' is not equal!", expected.getIntArray(),
actual.getIntArray() );
-        assertEquals( "Property 'intProperty' is not equal!", expected.getIntProperty(),
actual.getIntProperty() );
-        assertEquals( "Property 'invalidBoolean' is not equal!", expected.getInvalidBoolean(),
-                      actual.getInvalidBoolean() );
-        assertEquals( "Property 'listIndexed' is not equal!", expected.getListIndexed(),
actual.getListIndexed() );
-        assertEquals( "Property 'longProperty' is not equal!", expected.getLongProperty(),
actual.getLongProperty() );
-        assertEquals( "Property 'mapProperty' is not equal!", expected.getMapProperty(),
actual.getMapProperty() );
-        assertEquals( "Property 'nested' is not equal!", expected.getNested(), actual.getNested()
);
-        assertEquals( "Property 'nullProperty' is not equal!", expected.getNullProperty(),
actual.getNullProperty() );
-        assertEquals( "Property 'shortProperty' is not equal!", expected.getShortProperty(),
actual.getShortProperty() );
-        assertArrayEquals( "Property 'stringArray' is not equal!", expected.getStringArray(),
actual.getStringArray() );
-        assertEquals( "Property 'stringProperty' is not equal!", expected.getStringProperty(),
-                      actual.getStringProperty() );
-    }
-
 }

Modified: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PopulateTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PopulateTestCase.java?rev=1300952&r1=1300951&r2=1300952&view=diff
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PopulateTestCase.java
(original)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/PopulateTestCase.java
Thu Mar 15 12:24:52 2012
@@ -18,8 +18,8 @@ package org.apache.commons.beanutils2;
  */
 
 import static org.apache.commons.beanutils2.BeanUtils.on;
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
@@ -34,6 +34,7 @@ public class PopulateTestCase
 {
 
     private TestBean target;
+    private TestBean defaults;
 
     private Map<String, Object> properties;
 
@@ -41,6 +42,7 @@ public class PopulateTestCase
     public void setUp()
     {
         target = new TestBean();
+        defaults = new TestBean();
         properties = new HashMap<String, Object>();
     }
 
@@ -48,6 +50,7 @@ public class PopulateTestCase
     public void tearDown()
     {
         target = null;
+        defaults = null;
         properties = null;
     }
 
@@ -56,7 +59,7 @@ public class PopulateTestCase
         throws Exception
     {
         on( target ).populate( properties );
-        assertTrue( target.equals( new TestBean() ) );
+        assertTrue( target.equals( defaults ) );
     }
 
     @Test( expected = NullPointerException.class )
@@ -72,7 +75,7 @@ public class PopulateTestCase
     {
         properties.put( null, new Object() );
         on( target ).populate( properties );
-        assertTrue( target.equals( new TestBean() ) );
+        assertTrue( target.equals( defaults ) );
     }
 
     @Test
@@ -91,7 +94,7 @@ public class PopulateTestCase
     {
         properties.put( "unkown", "String value" );
         on( target ).populate( properties );
-        assertTrue( target.equals( new TestBean() ) );
+        assertEquals( defaults, target ) ;
     }
 
     @Test( expected = IllegalArgumentException.class )
@@ -121,17 +124,11 @@ public class PopulateTestCase
 
     private void validateArrayPropertiesOnTarget()
     {
-        int[] intArray = target.getIntArray();
-        assertNotNull( "intArray is not present", intArray );
-        assertEquals( "intArray has the worng length", 3, intArray.length );
-        assertEquals( "intArray[0] has the wrong value", 123, intArray[0] );
-        assertEquals( "intArray[1] has the wrong value", 456, intArray[1] );
-        assertEquals( "intArray[2] has the wrong value", 789, intArray[2] );
-        String[] stringArray = target.getStringArray();
-        assertNotNull( "stringArray is not present", stringArray );
-        assertEquals( "stringArray has the wrong length", 2, stringArray.length );
-        assertEquals( "stringArray[0] has the wrong value", "New String 0", stringArray[0]
);
-        assertEquals( "stringArray[1] has the wrong value", "New String 1", stringArray[1]
);
+        int[] expectedInts = (int[]) properties.get( "intArray" );
+        assertArrayEquals( expectedInts, target.getIntArray() );
+
+        String[] expectedStrings = (String[]) properties.get( "stringArray" );
+        assertArrayEquals( expectedStrings, target.getStringArray() );
     }
 
     @Test
@@ -146,35 +143,76 @@ public class PopulateTestCase
     private void setUpScalarProperties()
     {
         properties.put( "booleanProperty", false );
-        // booleanSecond is left at true
+        // booleanSecond is left at default value
         properties.put( "byteProperty", (byte) 111 );
         properties.put( "doubleProperty", 432.0 );
-        // floatProperty is left at 123.0
+        // floatProperty is left at default value
         properties.put( "intProperty", 543 );
         properties.put( "longProperty", 123456789l );
         properties.put( "nullProperty", "Non-null value" );
         properties.put( "shortProperty", (short) 654 );
-        // stringProperty is left at "This is a string"
+        // stringProperty is left at default value
         properties.put( "writeOnlyProperty", "New writeOnlyProperty value" );
         properties.put( "readOnlyProperty", "New readOnlyProperty value" );
     }
 
     private void validateScalarPropertiesOnTarget()
     {
-        assertEquals( "booleanProperty has the wrong value!", false, target.getBooleanProperty()
);
-        assertEquals( "booleanSecond has the wrong value!", true, target.isBooleanSecond()
);
-        assertEquals( "byteProperty has the wrong value!", (byte) 111, target.getByteProperty()
);
-        assertEquals( "doubleProperty has the wrong value!", 432.0, target.getDoubleProperty(),
0.005 );
-        assertEquals( "floatProperty has the wrong value!", (float) 123.0, target.getFloatProperty(),
(float) 0.005 );
-        assertEquals( "intProperty has the wrong value!", 543, target.getIntProperty() );
-        assertEquals( "longProperty has the wrong value!", 123456789l, target.getLongProperty()
);
-        assertEquals( "nullProperty has the wrong value!", "Non-null value", target.getNullProperty()
);
-        assertEquals( "shortProperty has the wrong value!", (short) 654, target.getShortProperty()
);
-        assertEquals( "stringProperty has the wrong value!", "This is a string", target.getStringProperty()
);
-        assertEquals( "writeOnlyProperty has the wrong value!", "New writeOnlyProperty value",
+        boolean expectedBoolean = (Boolean) properties.get( "booleanProperty" );
+        // was left at default value
+        boolean expectedBooleanSecond = defaults.isBooleanSecond();
+        byte expectedByte = (Byte) properties.get( "byteProperty" );
+        double expectedDouble = (Double) properties.get( "doubleProperty" );
+        // was left at default
+        float expectedFloat = defaults.getFloatProperty();
+        int expectedInt = (Integer) properties.get( "intProperty" );
+        long expectedLong = (Long) properties.get( "longProperty" );
+        String expectedNull = (String) properties.get( "nullProperty" );
+        short expectedShort = (Short) properties.get( "shortProperty" );
+        String expectedString = defaults.getStringProperty();
+        String expectedWriteOnly = (String) properties.get( "writeOnlyProperty" );
+        String expectedReadOnly = defaults.getReadOnlyProperty();
+
+        assertEquals( "booleanProperty has the wrong value!", expectedBoolean, target.getBooleanProperty()
);
+        assertEquals( "booleanSecond has the wrong value!", expectedBooleanSecond, target.isBooleanSecond()
);
+        assertEquals( "byteProperty has the wrong value!", expectedByte, target.getByteProperty()
);
+        assertEquals( "doubleProperty has the wrong value!", expectedDouble, target.getDoubleProperty(),
0.005 );
+        assertEquals( "floatProperty has the wrong value!", expectedFloat, target.getFloatProperty(),
(float) 0.005 );
+        assertEquals( "intProperty has the wrong value!", expectedInt, target.getIntProperty()
);
+        assertEquals( "longProperty has the wrong value!", expectedLong, target.getLongProperty()
);
+        assertEquals( "nullProperty has the wrong value!", expectedNull, target.getNullProperty()
);
+        assertEquals( "shortProperty has the wrong value!", expectedShort, target.getShortProperty()
);
+        assertEquals( "stringProperty has the wrong value!", expectedString, target.getStringProperty()
);
+        assertEquals( "writeOnlyProperty has the wrong value!", expectedWriteOnly,
                       target.getWriteOnlyPropertyValue() );
-        assertEquals( "readOnlyProperty has the wrong value!", new TestBean().getReadOnlyProperty(),
+        assertEquals( "readOnlyProperty has the wrong value!", expectedReadOnly,
                       target.getReadOnlyProperty() );
     }
 
+    /**
+     * Makes sure that read only properties are ignored
+     */
+    @Test
+    public void populateReadOnly()
+        throws Exception
+    {
+        properties.put( "readOnlyProperty", "Some Value" );
+        on( target ).populate( properties );
+        assertTrue( target.equals( defaults ) );
+    }
+
+    /**
+     * Makes sure, that ignoring read only property does not cause writable properties to
be ignored
+     */
+    @Test
+    public void populateReadOnlyAndOther()
+        throws Exception
+    {
+        properties.put( "readOnlyProperty", "Some value" );
+        properties.put( "stringProperty", "Some other value" );
+        on( target ).populate( properties );
+
+        defaults.setStringProperty( "Some other value" );
+        assertTrue( target.equals( defaults ) );
+    }
 }

Added: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java?rev=1300952&view=auto
==============================================================================
--- commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
(added)
+++ commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
Thu Mar 15 12:24:52 2012
@@ -0,0 +1,111 @@
+package org.apache.commons.beanutils2;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+final class TestBeanUtils
+{
+    private TestBeanUtils()
+    {
+        // private constructor to prevent instantiation
+    }
+
+    public static void changeArrayProperties( TestBean testBean )
+    {
+        int intArray[] = new int[] { 123, 456, 789 };
+        String stringArray[] = new String[] { "New String 0", "New String 1" };
+        testBean.setIntArray( intArray );
+        testBean.setStringArray( stringArray );
+    }
+
+    public static void changeScalarProperties( TestBean testBean )
+    {
+        testBean.setBooleanProperty( false );
+        // booleanSecond is left at true
+        testBean.setByteProperty( (byte) 111 );
+        testBean.setDoubleProperty( 432.0 );
+        // floatProperty is left at 123.0
+        testBean.setIntProperty( 543 );
+        testBean.setLongProperty( 123456789l );
+        testBean.setNullProperty( "Non-null value" );
+        testBean.setShortProperty( (short) 654 );
+        // stringProperty is left at "This is a string"
+    }
+
+    /**
+     * Asserts that all properties that are readable and writable on {@code actual} are equal
to those on
+     * {@code expected}.
+     *
+     * @param expected the {@code TestBean} with the expected properties.
+     * @param actual the {@code TestBean} with the actual values.
+     */
+    public static void assertReadWritePropertiesEquals( TestBean expected, TestBean actual
)
+    {
+        assertEquals( "Property 'anotherNested' is not equal!", expected.getAnotherNested(),
actual.getAnotherNested() );
+        assertEquals( "Property 'booleanProperty' is not equal!", expected.getBooleanProperty(),
+                      actual.getBooleanProperty() );
+        assertEquals( "Property 'booleanSecond' is not equal!", expected.isBooleanSecond(),
actual.isBooleanSecond() );
+        assertEquals( "Property 'byteProperty' is not equal!", expected.getByteProperty(),
actual.getByteProperty() );
+        assertArrayEquals( "Property 'DateArrayProperty' is not equal!", expected.getDateArrayProperty(),
+                           actual.getDateArrayProperty() );
+        assertEquals( "Property 'dateProperty' is not equal!", expected.getDateProperty(),
actual.getDateProperty() );
+        assertEquals( "Property 'doubleProperty' is not equal!", expected.getDoubleProperty(),
+                      actual.getDoubleProperty(), 0.0 );
+        assertArrayEquals( "Property 'dupProperty' is not equal!", expected.getDupProperty(),
actual.getDupProperty() );
+        assertEquals( "Property 'floatProperty' is not equal!", expected.getFloatProperty(),
actual.getFloatProperty(),
+                      0.0 );
+        assertArrayEquals( "Property 'intArrayProperty' is not equal!", expected.getIntArray(),
actual.getIntArray() );
+        assertEquals( "Property 'intProperty' is not equal!", expected.getIntProperty(),
actual.getIntProperty() );
+        assertEquals( "Property 'invalidBoolean' is not equal!", expected.getInvalidBoolean(),
+                      actual.getInvalidBoolean() );
+        assertEquals( "Property 'listIndexed' is not equal!", expected.getListIndexed(),
actual.getListIndexed() );
+        assertEquals( "Property 'longProperty' is not equal!", expected.getLongProperty(),
actual.getLongProperty() );
+        assertEquals( "Property 'mapProperty' is not equal!", expected.getMapProperty(),
actual.getMapProperty() );
+        assertEquals( "Property 'nested' is not equal!", expected.getNested(), actual.getNested()
);
+        assertEquals( "Property 'nullProperty' is not equal!", expected.getNullProperty(),
actual.getNullProperty() );
+        assertEquals( "Property 'shortProperty' is not equal!", expected.getShortProperty(),
actual.getShortProperty() );
+        assertArrayEquals( "Property 'stringArray' is not equal!", expected.getStringArray(),
actual.getStringArray() );
+        assertEquals( "Property 'stringProperty' is not equal!", expected.getStringProperty(),
+                      actual.getStringProperty() );
+    }
+
+    /**
+     * Asserts, that complex properties of {@code referenced} are the same as in {@code referencing}
(that they are just
+     * referenced).
+     */
+    public static void assertShallow( TestBean referenced, TestBean referencing )
+    {
+        assertSame( referenced.getAnotherNested(), referencing.getAnotherNested() );
+        assertSame( referenced.getDateArrayProperty(), referencing.getDateArrayProperty()
);
+        assertSame( referenced.getDateProperty(), referencing.getDateProperty() );
+        assertSame( referenced.getDateProperty(), referencing.getDateProperty() );
+        assertSame( referenced.getDupProperty(), referencing.getDupProperty() );
+        assertSame( referenced.getIntArray(), referencing.getIntArray() );
+        assertSame( referenced.getMapProperty(), referencing.getMapProperty() );
+        // mappedNested and nested are lazy initialized, so the following getXXX calls will
create new instances on
+        // both, clone and original, causing the assertions to fail.
+        // assertSame(clone.getMappedNested(), original.getMappedNested());
+        // assertSame(clone.getNested(), original.getNested());
+        assertSame( referenced.getStringArray(), referencing.getStringArray() );
+        assertSame( referenced.getStringProperty(), referencing.getStringProperty() );
+    }
+
+}

Propchange: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/TestBeanUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message