harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r412641 [16/32] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/ main/java/java/beans/beancontext/ test/java-internal/java/beans/beancontext/ test/java/org/apache/harmony/beans/tests/ test/java/org/ap...
Date Thu, 08 Jun 2006 03:40:30 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java Wed Jun  7 20:40:24 2006
@@ -1,166 +1,166 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.MethodDescriptor;
-import java.beans.ParameterDescriptor;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test for MethodDescriptor
- */
-public class MethodDescriptorTest extends TestCase {
-
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    /*
-     * Class under test for void MethodDescriptor(Method)
-     */
-    public void testMethodDescriptorMethod() throws SecurityException,
-            NoSuchMethodException {
-        String beanName = "MethodDescriptorTest.bean";
-        MockJavaBean bean = new MockJavaBean(beanName);
-        Method method = bean.getClass().getMethod("getBeanName", (Class[])null);
-        MethodDescriptor md = new MethodDescriptor(method);
-
-        assertSame(method, md.getMethod());
-        assertNull(md.getParameterDescriptors());
-        
-        assertEquals(method.getName(), md.getDisplayName());
-        assertEquals(method.getName(), md.getName());
-        assertEquals(method.getName(), md.getShortDescription());
-
-        assertNotNull(md.attributeNames());
-
-        assertFalse(md.isExpert());
-        assertFalse(md.isHidden());
-        assertFalse(md.isPreferred());
-    }
-
-    public void testMethodDescriptorMethod_Null() {
-        Method method = null;
-        try {
-            MethodDescriptor md = new MethodDescriptor(method);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
-        }
-
-    }
-
-    /*
-     * Class under test for void MethodDescriptor(Method, ParameterDescriptor[])
-     */
-    public void testMethodDescriptorMethodParameterDescriptorArray()
-            throws SecurityException, NoSuchMethodException {
-        String beanName = "MethodDescriptorTest.bean";
-        MockJavaBean bean = new MockJavaBean(beanName);
-        Method method = bean.getClass().getMethod("setPropertyOne",
-                new Class[] { String.class });
-        ParameterDescriptor[] pds = new ParameterDescriptor[1];
-        pds[0] = new ParameterDescriptor();
-        pds[0].setValue(method.getName(), method.getReturnType());
-        MethodDescriptor md = new MethodDescriptor(method, pds);
-
-        assertSame(method, md.getMethod());
-        assertSame(pds, md.getParameterDescriptors());
-        assertEquals(pds[0].getValue(method.getName()), md
-                .getParameterDescriptors()[0].getValue(method.getName()));
-
-        assertEquals(method.getName(), md.getDisplayName());
-        assertEquals(method.getName(), md.getName());
-        assertEquals(method.getName(), md.getShortDescription());
-
-        assertNotNull(md.attributeNames());
-
-        assertFalse(md.isExpert());
-        assertFalse(md.isHidden());
-        assertFalse(md.isPreferred());
-    }
-
-    public void testMethodDescriptorMethodParameterDescriptorArray_MethodNull() {
-        Method method = null;
-        ParameterDescriptor[] pds = new ParameterDescriptor[1];
-        pds[0] = new ParameterDescriptor();
-        try {
-            MethodDescriptor md = new MethodDescriptor(method, pds);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    public void testMethodDescriptorMethodParameterDescriptorArray_PDNull()
-            throws SecurityException, NoSuchMethodException {
-        String beanName = "MethodDescriptorTest.bean";
-        MockJavaBean bean = new MockJavaBean(beanName);
-        Method method = bean.getClass().getMethod("setPropertyOne",
-                new Class[] { String.class });
-        MethodDescriptor md = new MethodDescriptor(method, null);
-
-        assertSame(method, md.getMethod());
-        assertNull(md.getParameterDescriptors());
-
-        assertEquals(method.getName(), md.getDisplayName());
-        assertEquals(method.getName(), md.getName());
-        assertEquals(method.getName(), md.getShortDescription());
-
-        assertNotNull(md.attributeNames());
-
-        assertFalse(md.isExpert());
-        assertFalse(md.isHidden());
-        assertFalse(md.isPreferred());
-    }
-    
-    /**
-     * @tests java.beans.MethodDescriptor#MethodDescriptor(
-     *        java.lang.reflect.Method)
-     */
-    public void test_Ctor1_NullPointerExpection() {
-        try {
-            // Regression for HARMONY-226
-            new MethodDescriptor(null);
-            fail("No expected NullPointerException");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * @tests java.beans.MethodDescriptor#MethodDescriptor(
-     *        java.lang.reflect.Method,
-     *        java.beans.ParameterDescriptor[])
-     */
-    public void test_Ctor2_NullPointerExpection() {
-        try {
-            // Regression for HARMONY-226
-            new MethodDescriptor(null, new ParameterDescriptor[0]);
-            fail("No expected NullPointerException");
-        } catch (NullPointerException e) {
-        }
-    }
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.MethodDescriptor;
+import java.beans.ParameterDescriptor;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for MethodDescriptor
+ */
+public class MethodDescriptorTest extends TestCase {
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /*
+     * Class under test for void MethodDescriptor(Method)
+     */
+    public void testMethodDescriptorMethod() throws SecurityException,
+            NoSuchMethodException {
+        String beanName = "MethodDescriptorTest.bean";
+        MockJavaBean bean = new MockJavaBean(beanName);
+        Method method = bean.getClass().getMethod("getBeanName", (Class[])null);
+        MethodDescriptor md = new MethodDescriptor(method);
+
+        assertSame(method, md.getMethod());
+        assertNull(md.getParameterDescriptors());
+        
+        assertEquals(method.getName(), md.getDisplayName());
+        assertEquals(method.getName(), md.getName());
+        assertEquals(method.getName(), md.getShortDescription());
+
+        assertNotNull(md.attributeNames());
+
+        assertFalse(md.isExpert());
+        assertFalse(md.isHidden());
+        assertFalse(md.isPreferred());
+    }
+
+    public void testMethodDescriptorMethod_Null() {
+        Method method = null;
+        try {
+            MethodDescriptor md = new MethodDescriptor(method);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+
+    }
+
+    /*
+     * Class under test for void MethodDescriptor(Method, ParameterDescriptor[])
+     */
+    public void testMethodDescriptorMethodParameterDescriptorArray()
+            throws SecurityException, NoSuchMethodException {
+        String beanName = "MethodDescriptorTest.bean";
+        MockJavaBean bean = new MockJavaBean(beanName);
+        Method method = bean.getClass().getMethod("setPropertyOne",
+                new Class[] { String.class });
+        ParameterDescriptor[] pds = new ParameterDescriptor[1];
+        pds[0] = new ParameterDescriptor();
+        pds[0].setValue(method.getName(), method.getReturnType());
+        MethodDescriptor md = new MethodDescriptor(method, pds);
+
+        assertSame(method, md.getMethod());
+        assertSame(pds, md.getParameterDescriptors());
+        assertEquals(pds[0].getValue(method.getName()), md
+                .getParameterDescriptors()[0].getValue(method.getName()));
+
+        assertEquals(method.getName(), md.getDisplayName());
+        assertEquals(method.getName(), md.getName());
+        assertEquals(method.getName(), md.getShortDescription());
+
+        assertNotNull(md.attributeNames());
+
+        assertFalse(md.isExpert());
+        assertFalse(md.isHidden());
+        assertFalse(md.isPreferred());
+    }
+
+    public void testMethodDescriptorMethodParameterDescriptorArray_MethodNull() {
+        Method method = null;
+        ParameterDescriptor[] pds = new ParameterDescriptor[1];
+        pds[0] = new ParameterDescriptor();
+        try {
+            MethodDescriptor md = new MethodDescriptor(method, pds);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    public void testMethodDescriptorMethodParameterDescriptorArray_PDNull()
+            throws SecurityException, NoSuchMethodException {
+        String beanName = "MethodDescriptorTest.bean";
+        MockJavaBean bean = new MockJavaBean(beanName);
+        Method method = bean.getClass().getMethod("setPropertyOne",
+                new Class[] { String.class });
+        MethodDescriptor md = new MethodDescriptor(method, null);
+
+        assertSame(method, md.getMethod());
+        assertNull(md.getParameterDescriptors());
+
+        assertEquals(method.getName(), md.getDisplayName());
+        assertEquals(method.getName(), md.getName());
+        assertEquals(method.getName(), md.getShortDescription());
+
+        assertNotNull(md.attributeNames());
+
+        assertFalse(md.isExpert());
+        assertFalse(md.isHidden());
+        assertFalse(md.isPreferred());
+    }
+    
+    /**
+     * @tests java.beans.MethodDescriptor#MethodDescriptor(
+     *        java.lang.reflect.Method)
+     */
+    public void test_Ctor1_NullPointerExpection() {
+        try {
+            // Regression for HARMONY-226
+            new MethodDescriptor(null);
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    /**
+     * @tests java.beans.MethodDescriptor#MethodDescriptor(
+     *        java.lang.reflect.Method,
+     *        java.beans.ParameterDescriptor[])
+     */
+    public void test_Ctor2_NullPointerExpection() {
+        try {
+            // Regression for HARMONY-226
+            new MethodDescriptor(null, new ParameterDescriptor[0]);
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Owner.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Owner.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Owner.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Owner.java Wed Jun  7 20:40:24 2006
@@ -1,36 +1,36 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-package org.apache.harmony.beans.tests.java.beans;
-
-public class MockBean4Owner_Owner {
-	private int v = 1;
-
-	public void loading() {
-		v = 999;
-	}
-
-	public int getV() {
-		return v;
-	}
-
-	public void setV(int v) {
-		this.v = v;
-	}
-
-	public boolean equals(Object o) {
-		return (o != null && this.getClass() == o.getClass() && this.v == ((MockBean4Owner_Owner) o).v);
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+package org.apache.harmony.beans.tests.java.beans;
+
+public class MockBean4Owner_Owner {
+	private int v = 1;
+
+	public void loading() {
+		v = 999;
+	}
+
+	public int getV() {
+		return v;
+	}
+
+	public void setV(int v) {
+		this.v = v;
+	}
+
+	public boolean equals(Object o) {
+		return (o != null && this.getClass() == o.getClass() && this.v == ((MockBean4Owner_Owner) o).v);
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Target.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Target.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Target.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4Owner_Target.java Wed Jun  7 20:40:24 2006
@@ -1,31 +1,31 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-package org.apache.harmony.beans.tests.java.beans;
-
-public class MockBean4Owner_Target {
-	MockBean4Owner_Owner v;
-
-	public MockBean4Owner_Owner getV() {
-		return v;
-	}
-
-	public void setV(MockBean4Owner_Owner v) {
-		this.v = v;
-	}
-
-	public boolean equals(Object o) {
-		return (this.getClass() == o.getClass() && this.v == ((MockBean4Owner_Target) o).v);
-	}
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+package org.apache.harmony.beans.tests.java.beans;
+
+public class MockBean4Owner_Target {
+	MockBean4Owner_Owner v;
+
+	public MockBean4Owner_Owner getV() {
+		return v;
+	}
+
+	public void setV(MockBean4Owner_Owner v) {
+		this.v = v;
+	}
+
+	public boolean equals(Object o) {
+		return (this.getClass() == o.getClass() && this.v == ((MockBean4Owner_Target) o).v);
+	}
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField.java Wed Jun  7 20:40:24 2006
@@ -1,42 +1,42 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-package org.apache.harmony.beans.tests.java.beans;
-
-public class MockBean4StaticField {
-	public static MockBean4StaticField inst = new MockBean4StaticField(999);
-
-	private int v;
-
-	public boolean equals(Object o) {
-		return (o.getClass().equals(this.getClass()) && this.v == ((MockBean4StaticField) o).v);
-	}
-
-	public MockBean4StaticField() {
-		v = 1;
-	}
-
-	public MockBean4StaticField(int i) {
-		v = i;
-	}
-
-	public int getV() {
-		return v;
-	}
-
-	public void setV(int v) {
-		this.v = v;
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+package org.apache.harmony.beans.tests.java.beans;
+
+public class MockBean4StaticField {
+	public static MockBean4StaticField inst = new MockBean4StaticField(999);
+
+	private int v;
+
+	public boolean equals(Object o) {
+		return (o.getClass().equals(this.getClass()) && this.v == ((MockBean4StaticField) o).v);
+	}
+
+	public MockBean4StaticField() {
+		v = 1;
+	}
+
+	public MockBean4StaticField(int i) {
+		v = i;
+	}
+
+	public int getV() {
+		return v;
+	}
+
+	public void setV(int v) {
+		this.v = v;
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField_PD.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField_PD.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField_PD.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockBean4StaticField_PD.java Wed Jun  7 20:40:24 2006
@@ -1,36 +1,36 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.Encoder;
-import java.beans.Expression;
-import java.beans.PersistenceDelegate;
-
-public class MockBean4StaticField_PD extends PersistenceDelegate {
-
-	public Expression instantiate(Object oldInstance, Encoder out) {
-		Expression exp = null;
-
-		try {
-			exp = new Expression(MockBean4StaticField.class.getField("inst"),
-					"get", new Object[] { null });
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-
-		return exp;
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+
+public class MockBean4StaticField_PD extends PersistenceDelegate {
+
+	public Expression instantiate(Object oldInstance, Encoder out) {
+		Expression exp = null;
+
+		try {
+			exp = new Expression(MockBean4StaticField.class.getField("inst"),
+					"get", new Object[] { null });
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		return exp;
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFakeEvent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFakeEvent.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFakeEvent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFakeEvent.java Wed Jun  7 20:40:24 2006
@@ -1,23 +1,23 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-/**
- * This is a fake event which is not a subclass of java.util.EventObject
- */
-public class MockFakeEvent {
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+/**
+ * This is a fake event which is not a subclass of java.util.EventObject
+ */
+public class MockFakeEvent {
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFooLabelBeanInfo.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFooLabelBeanInfo.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFooLabelBeanInfo.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockFooLabelBeanInfo.java Wed Jun  7 20:40:24 2006
@@ -1,48 +1,48 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.BeanDescriptor;
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.beans.SimpleBeanInfo;
-
-import org.apache.harmony.beans.tests.java.beans.mock.MockFooLabel;
-
-public class MockFooLabelBeanInfo extends SimpleBeanInfo {
-	Class clazz = MockFooLabel.class;
-
-	String suffix = ".MockFooLabelBeanInfo";
-
-	public BeanDescriptor getBeanDescriptor() {
-		BeanDescriptor beanDesc = new BeanDescriptor(clazz);
-		beanDesc.setName(beanDesc.getName() + suffix);
-		return beanDesc;
-	}
-
-	public PropertyDescriptor[] getPropertyDescriptors() {
-		PropertyDescriptor[] pds = new PropertyDescriptor[1];
-		try {
-			PropertyDescriptor pd = new PropertyDescriptor("text", clazz);
-			pd.setName(pd.getName() + suffix);
-			pds[0] = pd;
-		} catch (IntrospectionException e) {
-			e.printStackTrace();
-		}
-		return pds;
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.BeanDescriptor;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+import org.apache.harmony.beans.tests.java.beans.mock.MockFooLabel;
+
+public class MockFooLabelBeanInfo extends SimpleBeanInfo {
+	Class clazz = MockFooLabel.class;
+
+	String suffix = ".MockFooLabelBeanInfo";
+
+	public BeanDescriptor getBeanDescriptor() {
+		BeanDescriptor beanDesc = new BeanDescriptor(clazz);
+		beanDesc.setName(beanDesc.getName() + suffix);
+		return beanDesc;
+	}
+
+	public PropertyDescriptor[] getPropertyDescriptors() {
+		PropertyDescriptor[] pds = new PropertyDescriptor[1];
+		try {
+			PropertyDescriptor pd = new PropertyDescriptor("text", clazz);
+			pd.setName(pd.getName() + suffix);
+			pds[0] = pd;
+		} catch (IntrospectionException e) {
+			e.printStackTrace();
+		}
+		return pds;
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockJavaBean.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockJavaBean.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockJavaBean.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockJavaBean.java Wed Jun  7 20:40:24 2006
@@ -1,229 +1,229 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.io.Serializable;
-
-public class MockJavaBean implements Serializable {
-	/**
-	 * Comment for <code>serialVersionUID</code>
-	 */
-	private static final long serialVersionUID = 1L;
-
-	private String beanName;
-
-	private String propertyOne;
-
-	private Integer propertyTwo;
-
-	private String propertyThree;
-
-	private String[] propertyFour;
-
-	private String[] propertyFive;
-
-	private Integer[] propertySix;
-
-	private String protectedProp;
-
-	public MockJavaBean() {
-		this.beanName = getClass().getName();
-	}
-
-	public MockJavaBean(String beanName) {
-		this.beanName = beanName;
-	}
-
-	/**
-	 * @return Returns the beanName.
-	 */
-	public String getBeanName() {
-		return beanName;
-	}
-
-	/**
-	 * @param beanName
-	 *            The beanName to set.
-	 */
-	public void setBeanName(String beanName) {
-		this.beanName = beanName;
-	}
-
-	/**
-	 * @return Returns the propertyOne.
-	 */
-	public String getPropertyOne() {
-		return propertyOne;
-	}
-
-	/**
-	 * @param propertyOne
-	 *            The propertyOne to set.
-	 */
-	public void setPropertyOne(String propertyOne) {
-		this.propertyOne = propertyOne;
-	}
-
-	/**
-	 * @return Returns the propertyTwo.
-	 */
-	public Integer getPropertyTwo() {
-		return propertyTwo;
-	}
-
-	/**
-	 * @param propertyTwo
-	 *            The propertyTwo to set.
-	 */
-	public void setPropertyTwo(Integer propertyTwo) {
-		this.propertyTwo = propertyTwo;
-	}
-
-	public String invalidGetMethod(String arg) {
-		// for PropertyDescriptorTest: with args
-		return arg;
-	}
-
-	public void invalidGetMethod() {
-		// for PropertyDescriptorTest
-		// return void
-	}
-
-	/**
-	 * @return Returns the propertyThree.
-	 */
-	public String getPropertyThree() {
-		return propertyThree;
-	}
-
-	/**
-	 * @param propertyThree
-	 *            The propertyThree to set.
-	 */
-	public void setPropertyThree(String propertyThree) {
-		this.propertyThree = propertyThree;
-	}
-
-	/**
-	 * @return Returns the propertyFour.
-	 */
-	public String[] getPropertyFour() {
-		return propertyFour;
-	}
-
-	/**
-	 * @param propertyFour
-	 *            The propertyFour to set.
-	 */
-	public void setPropertyFour(String[] propertyFour) {
-		this.propertyFour = propertyFour;
-	}
-
-	public String getPropertyFour(int i) {
-		return getPropertyFour()[i];
-	}
-
-	public void getPropertyFourInvalid(int i) {
-
-	}
-
-	public void setPropertyFour(int i, String value) {
-		propertyFour[i] = value;
-	}
-
-	public void setPropertyFour(int i, int value) {
-		propertyFour[i] = "";
-	}
-
-	public int setPropertyFourInvalid(int i, String value) {
-		return i;
-	}
-
-	public void setPropertyFourInvalid2(String i, String value) {
-		// return i;
-	}
-
-	/**
-	 * @return Returns the propertyFive.
-	 */
-	public String[] getPropertyFive() {
-		return propertyFive;
-	}
-
-	/**
-	 * @param propertyFive
-	 *            The propertyFive to set.
-	 */
-	public void setPropertyFive(String[] propertyFive) {
-		this.propertyFive = propertyFive;
-	}
-
-	public String getPropertyFive(int i) {
-		return getPropertyFive()[i];
-	}
-
-	public void setPropertyFive(int i, String value) {
-		propertyFive[i] = value;
-	}
-
-	/**
-	 * @return Returns the protectedProp.
-	 */
-	protected String getProtectedProp() {
-		return protectedProp;
-	}
-
-	/**
-	 * @param protectedProp
-	 *            The protectedProp to set.
-	 */
-	protected void setProtectedProp(String protectedProp) {
-		this.protectedProp = protectedProp;
-	}
-
-	/**
-	 * @return Returns the propertySix.
-	 */
-	public Integer[] getPropertySix() {
-		return propertySix;
-	}
-
-	public Integer getPropertySix(int i) {
-		return null;
-	}
-
-	/**
-	 * @param propertySix
-	 *            The propertySix to set.
-	 */
-	public void setPropertySix(Integer[] propertySix) {
-		this.propertySix = propertySix;
-	}
-
-	public void setPropertySix(int i, Integer value) {
-
-	}
-
-	public void addMockPropertyChangeListener(
-			MockPropertyChangeListener listener) {
-
-	}
-
-	public void removeMockPropertyChangeListener(
-			MockPropertyChangeListener listener) {
-
-	}
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.io.Serializable;
+
+public class MockJavaBean implements Serializable {
+	/**
+	 * Comment for <code>serialVersionUID</code>
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private String beanName;
+
+	private String propertyOne;
+
+	private Integer propertyTwo;
+
+	private String propertyThree;
+
+	private String[] propertyFour;
+
+	private String[] propertyFive;
+
+	private Integer[] propertySix;
+
+	private String protectedProp;
+
+	public MockJavaBean() {
+		this.beanName = getClass().getName();
+	}
+
+	public MockJavaBean(String beanName) {
+		this.beanName = beanName;
+	}
+
+	/**
+	 * @return Returns the beanName.
+	 */
+	public String getBeanName() {
+		return beanName;
+	}
+
+	/**
+	 * @param beanName
+	 *            The beanName to set.
+	 */
+	public void setBeanName(String beanName) {
+		this.beanName = beanName;
+	}
+
+	/**
+	 * @return Returns the propertyOne.
+	 */
+	public String getPropertyOne() {
+		return propertyOne;
+	}
+
+	/**
+	 * @param propertyOne
+	 *            The propertyOne to set.
+	 */
+	public void setPropertyOne(String propertyOne) {
+		this.propertyOne = propertyOne;
+	}
+
+	/**
+	 * @return Returns the propertyTwo.
+	 */
+	public Integer getPropertyTwo() {
+		return propertyTwo;
+	}
+
+	/**
+	 * @param propertyTwo
+	 *            The propertyTwo to set.
+	 */
+	public void setPropertyTwo(Integer propertyTwo) {
+		this.propertyTwo = propertyTwo;
+	}
+
+	public String invalidGetMethod(String arg) {
+		// for PropertyDescriptorTest: with args
+		return arg;
+	}
+
+	public void invalidGetMethod() {
+		// for PropertyDescriptorTest
+		// return void
+	}
+
+	/**
+	 * @return Returns the propertyThree.
+	 */
+	public String getPropertyThree() {
+		return propertyThree;
+	}
+
+	/**
+	 * @param propertyThree
+	 *            The propertyThree to set.
+	 */
+	public void setPropertyThree(String propertyThree) {
+		this.propertyThree = propertyThree;
+	}
+
+	/**
+	 * @return Returns the propertyFour.
+	 */
+	public String[] getPropertyFour() {
+		return propertyFour;
+	}
+
+	/**
+	 * @param propertyFour
+	 *            The propertyFour to set.
+	 */
+	public void setPropertyFour(String[] propertyFour) {
+		this.propertyFour = propertyFour;
+	}
+
+	public String getPropertyFour(int i) {
+		return getPropertyFour()[i];
+	}
+
+	public void getPropertyFourInvalid(int i) {
+
+	}
+
+	public void setPropertyFour(int i, String value) {
+		propertyFour[i] = value;
+	}
+
+	public void setPropertyFour(int i, int value) {
+		propertyFour[i] = "";
+	}
+
+	public int setPropertyFourInvalid(int i, String value) {
+		return i;
+	}
+
+	public void setPropertyFourInvalid2(String i, String value) {
+		// return i;
+	}
+
+	/**
+	 * @return Returns the propertyFive.
+	 */
+	public String[] getPropertyFive() {
+		return propertyFive;
+	}
+
+	/**
+	 * @param propertyFive
+	 *            The propertyFive to set.
+	 */
+	public void setPropertyFive(String[] propertyFive) {
+		this.propertyFive = propertyFive;
+	}
+
+	public String getPropertyFive(int i) {
+		return getPropertyFive()[i];
+	}
+
+	public void setPropertyFive(int i, String value) {
+		propertyFive[i] = value;
+	}
+
+	/**
+	 * @return Returns the protectedProp.
+	 */
+	protected String getProtectedProp() {
+		return protectedProp;
+	}
+
+	/**
+	 * @param protectedProp
+	 *            The protectedProp to set.
+	 */
+	protected void setProtectedProp(String protectedProp) {
+		this.protectedProp = protectedProp;
+	}
+
+	/**
+	 * @return Returns the propertySix.
+	 */
+	public Integer[] getPropertySix() {
+		return propertySix;
+	}
+
+	public Integer getPropertySix(int i) {
+		return null;
+	}
+
+	/**
+	 * @param propertySix
+	 *            The propertySix to set.
+	 */
+	public void setPropertySix(Integer[] propertySix) {
+		this.propertySix = propertySix;
+	}
+
+	public void setPropertySix(int i, Integer value) {
+
+	}
+
+	public void addMockPropertyChangeListener(
+			MockPropertyChangeListener listener) {
+
+	}
+
+	public void removeMockPropertyChangeListener(
+			MockPropertyChangeListener listener) {
+
+	}
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeEvent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeEvent.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeEvent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeEvent.java Wed Jun  7 20:40:24 2006
@@ -1,37 +1,37 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.util.EventObject;
-
-/**
- * This is a mock class for EventSetDescriptor testing
- */
-public class MockPropertyChangeEvent extends EventObject {
-
-	/**
-	 * Comment for <code>serialVersionUID</code>
-	 */
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * @param source
-	 */
-	public MockPropertyChangeEvent(Object source) {
-		super(source);
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.util.EventObject;
+
+/**
+ * This is a mock class for EventSetDescriptor testing
+ */
+public class MockPropertyChangeEvent extends EventObject {
+
+	/**
+	 * Comment for <code>serialVersionUID</code>
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * @param source
+	 */
+	public MockPropertyChangeEvent(Object source) {
+		super(source);
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeListener.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeListener.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MockPropertyChangeListener.java Wed Jun  7 20:40:24 2006
@@ -1,36 +1,36 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-/**
- * TODO Type description
- */
-public interface MockPropertyChangeListener {
-	/*
-	 * fire MockPropertyChange event.
-	 */
-
-	public void mockPropertyChange(MockPropertyChangeEvent e);
-
-	public void mockPropertyChange2(MockPropertyChangeEvent e);
-
-	public void mockPropertyChange3(MockPropertyChangeEvent e);
-
-	public void mockNotAEventObject(MockFakeEvent event);
-
-	public void mockPropertyChange_Invalid();
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+/**
+ * TODO Type description
+ */
+public interface MockPropertyChangeListener {
+	/*
+	 * fire MockPropertyChange event.
+	 */
+
+	public void mockPropertyChange(MockPropertyChangeEvent e);
+
+	public void mockPropertyChange2(MockPropertyChangeEvent e);
+
+	public void mockPropertyChange3(MockPropertyChangeEvent e);
+
+	public void mockNotAEventObject(MockFakeEvent event);
+
+	public void mockPropertyChange_Invalid();
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java Wed Jun  7 20:40:24 2006
@@ -1,40 +1,40 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.ParameterDescriptor;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test for ParameterDescriptor.
- */
-public class ParameterDescriptorTest extends TestCase {
-
-	public void testParameterDescriptor() {
-		ParameterDescriptor pd = new ParameterDescriptor();
-		assertNull(pd.getDisplayName());
-		assertNull(pd.getName());
-		assertNull(pd.getShortDescription());
-
-		assertNotNull(pd.attributeNames());
-
-		assertFalse(pd.isExpert());
-		assertFalse(pd.isHidden());
-		assertFalse(pd.isPreferred());
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.ParameterDescriptor;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for ParameterDescriptor.
+ */
+public class ParameterDescriptorTest extends TestCase {
+
+	public void testParameterDescriptor() {
+		ParameterDescriptor pd = new ParameterDescriptor();
+		assertNull(pd.getDisplayName());
+		assertNull(pd.getName());
+		assertNull(pd.getShortDescription());
+
+		assertNotNull(pd.attributeNames());
+
+		assertFalse(pd.isExpert());
+		assertFalse(pd.isHidden());
+		assertFalse(pd.isPreferred());
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java Wed Jun  7 20:40:24 2006
@@ -1,452 +1,452 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed 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.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.Encoder;
-import java.beans.ExceptionListener;
-import java.beans.Expression;
-import java.beans.PersistenceDelegate;
-import java.beans.Statement;
-
-import junit.framework.TestCase;
-import org.apache.harmony.beans.tests.java.beans.mock.MockFoo;
-import org.apache.harmony.beans.tests.java.beans.mock.MockFooStop;
-import tests.util.CallVerificationStack;
-
-/**
- * Test java.beans.PersistenceDelegate
- */
-public class PersistenceDelegateTest extends TestCase {
-
-	protected void setUp() throws Exception {
-		super.setUp();
-		CallVerificationStack.getInstance().clear();
-	}
-
-	/*
-	 * Test the constructor.
-	 */
-	public void testConstructor() {
-		new DummyPersistenceDelegate();
-	}
-
-	/*
-	 * Tests writeObject() under normal condition when mutatesTo() returns True.
-	 */
-	public void testWriteObject_NormalMutatesToTrue() {
-		MockPersistenceDelegate pd = new MockPersistenceDelegate(true, true);
-		MockEncoder enc = new MockEncoder();
-		MockFoo oldInstance = new MockFoo();
-		enc.setPersistenceDelegate(MockFooStop.class, pd);
-
-		pd.writeObject(oldInstance, enc);
-
-		// should have called initialize()
-		assertSame(enc, CallVerificationStack.getInstance().pop());
-		assertSame(null, CallVerificationStack.getInstance().pop());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("initialize", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(MockFoo.class, CallVerificationStack.getInstance().pop());
-
-		// should have called mutatesTo()
-		assertSame(null, CallVerificationStack.getInstance().pop());
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("mutatesTo", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-
-		// should have called Encoder.get()
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("get", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-
-		assertTrue(CallVerificationStack.getInstance().empty());
-	}
-
-	/*
-	 * Tests writeObject() under normal condition when mutatesTo() returns
-	 * false.
-	 */
-	public void testWriteObject_NormalMutatesToFalse() {
-		MockPersistenceDelegate pd = new MockPersistenceDelegate(false, true);
-		MockEncoder enc = new MockEncoder();
-		MockFoo oldInstance = new MockFoo();
-		enc.setPersistenceDelegate(MockFooStop.class, pd);
-
-		pd.writeObject(oldInstance, enc);
-
-		// should have called writeExpression()
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("writeExpression", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertTrue(CallVerificationStack.getInstance().pop() instanceof Expression);
-
-		// should have called instantiate()
-		assertSame(enc, CallVerificationStack.getInstance().pop());
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("instantiate", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-
-		// should have called Encoder.remove()
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("remove", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-
-		// should have called mutatesTo()
-		assertSame(null, CallVerificationStack.getInstance().pop());
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("mutatesTo", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-
-		// should have called Encoder.get()
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("get", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
-
-		assertTrue(CallVerificationStack.getInstance().empty());
-	}
-
-	/*
-	 * Tests writeObject() when object is null.
-	 */
-	public void testWriteObject_NullObject() {
-		MockPersistenceDelegate pd = new MockPersistenceDelegate();
-		MockEncoder enc = new MockEncoder();
-		enc.setPersistenceDelegate(MockFooStop.class, pd);
-
-		try {
-			pd.writeObject(null, enc);
-			fail("Should throw NullPointerException!");
-		} catch (NullPointerException ex) {
-			// expected
-		}
-	}
-
-	/*
-	 * Tests writeObject() when encoder is null.
-	 */
-	public void testWriteObject_NullEncoder() {
-		MockPersistenceDelegate pd = new MockPersistenceDelegate();
-		MockEncoder enc = new MockEncoder();
-		enc.setPersistenceDelegate(MockFooStop.class, pd);
-
-		try {
-			pd.writeObject(new MockFoo(), null);
-			fail("Should throw NullPointerException!");
-		} catch (NullPointerException ex) {
-			// expected
-		}
-	}
-
-	/*
-	 * Tests initialize() under normal conditions.
-	 */
-	public void testInitialize_Normal() {
-		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
-		Encoder enc = new Encoder();
-		Object o1 = new Object();
-		Object o2 = new Object();
-		enc.setPersistenceDelegate(MockFooStop.class,
-				new MockPersistenceDelegate());
-		pd.initialize(MockFoo.class, o1, o2, enc);
-		assertSame(enc, CallVerificationStack.getInstance().pop());
-		assertSame(o2, CallVerificationStack.getInstance().pop());
-		assertSame(o1, CallVerificationStack.getInstance().pop());
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("initialize", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(MockFooStop.class, CallVerificationStack.getInstance().pop());
-		assertTrue(CallVerificationStack.getInstance().empty());
-		// test interface
-		o1 = new MockObject();
-		enc.setPersistenceDelegate(MockInterface.class,
-				new MockPersistenceDelegate());
-		pd.initialize(MockObject.class, o1, o1, enc);
-		assertTrue(CallVerificationStack.getInstance().empty());
-	}
-
-	/*
-	 * Tests initialize() with null class.
-	 */
-	public void testInitialize_NullClass() {
-		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
-		Encoder enc = new Encoder();
-		Object o1 = new Object();
-		Object o2 = new Object();
-		enc.setPersistenceDelegate(MockFooStop.class,
-				new MockPersistenceDelegate());
-		try {
-			pd.initialize(null, o1, o2, enc);
-			fail("Should throw NullPointerException!");
-		} catch (NullPointerException ex) {
-			// expected
-		}
-	}
-
-	/*
-	 * Tests initialize() with null old and new instances.
-	 */
-	public void testInitialize_NullInstances() {
-		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
-		Encoder enc = new Encoder();
-		enc.setPersistenceDelegate(MockFooStop.class,
-				new MockPersistenceDelegate());
-		pd.initialize(MockFoo.class, null, null, enc);
-		assertSame(enc, CallVerificationStack.getInstance().pop());
-		assertSame(null, CallVerificationStack.getInstance().pop());
-		assertSame(null, CallVerificationStack.getInstance().pop());
-		assertEquals(
-				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
-				CallVerificationStack.getInstance().getCurrentSourceClass());
-		assertEquals("initialize", CallVerificationStack.getInstance()
-				.getCurrentSourceMethod());
-		assertSame(MockFooStop.class, CallVerificationStack.getInstance().pop());
-		assertTrue(CallVerificationStack.getInstance().empty());
-	}
-
-	/*
-	 * Tests initialize() with null encoder.
-	 */
-	public void testInitialize_NullEncoder() {
-		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
-		Object o1 = new Object();
-		Object o2 = new Object();
-		try {
-			pd.initialize(MockFoo.class, o1, o2, null);
-			fail("Should throw NullPointerException!");
-		} catch (NullPointerException ex) {
-			// expected
-		}
-	}
-
-	/*
-	 * Tests mutatesTo() under normal conditions.
-	 */
-	public void testMutatesTo_Normal() {
-		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
-		assertTrue(pd.mutatesTo("test1", "test2"));
-		assertFalse(pd.mutatesTo(new Object(), new Object() {
-			public int hashCode() {
-				return super.hashCode();
-			}
-		}));
-		assertFalse(pd.mutatesTo(new MockFoo(), new MockFooStop()));
-		// DummyEncoder enc = new DummyEncoder();
-		// pd.writeObject(new MockFoo(), enc);
-	}
-
-	/*
-	 * Tests mutatesTo() with null parameters.
-	 */
-	public void testMutatesTo_Null() {
-		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
-		assertFalse(pd.mutatesTo("test", null));
-		assertFalse(pd.mutatesTo(null, null));
-		try {
-			pd.mutatesTo(null, "test");
-			fail("Should throw NullPointerException!");
-		} catch (NullPointerException ex) {
-			// expected
-		}
-	}
-
-	/*
-	 * Mock interface.
-	 */
-	static interface MockInterface {
-
-	}
-
-	/*
-	 * Mock interface.
-	 */
-	static class MockObject implements MockInterface {
-
-	}
-
-	/*
-	 * Mock Encoder.
-	 */
-	static class MockEncoder extends Encoder {
-
-		public Object get(Object oldInstance) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (eles[2].getClassName().equals(
-					MockPersistenceDelegate.class.getName())) {
-				CallVerificationStack.getInstance().push(oldInstance);
-			}
-			return super.get(oldInstance);
-		}
-
-		public ExceptionListener getExceptionListener() {
-			return super.getExceptionListener();
-		}
-
-		public PersistenceDelegate getPersistenceDelegate(Class type) {
-			return super.getPersistenceDelegate(type);
-		}
-
-		public Object remove(Object oldInstance) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (eles[2].getClassName().equals(
-					MockPersistenceDelegate.class.getName())) {
-				CallVerificationStack.getInstance().push(oldInstance);
-			}
-			return super.remove(oldInstance);
-		}
-
-		public void setExceptionListener(ExceptionListener exceptionListener) {
-			super.setExceptionListener(exceptionListener);
-		}
-
-		public void setPersistenceDelegate(Class type,
-				PersistenceDelegate persistenceDelegate) {
-			super.setPersistenceDelegate(type, persistenceDelegate);
-		}
-
-		public void writeExpression(Expression oldExp) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (eles[2].getClassName().equals(
-					MockPersistenceDelegate.class.getName())) {
-				CallVerificationStack.getInstance().push(oldExp);
-			}
-			super.writeExpression(oldExp);
-		}
-
-		public void writeStatement(Statement oldStm) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (eles[2].getClassName().equals(
-					MockPersistenceDelegate.class.getName())) {
-				CallVerificationStack.getInstance().push(oldStm);
-			}
-			super.writeStatement(oldStm);
-		}
-
-		public void writeObject(Object o) {
-			super.writeObject(o);
-		}
-	}
-
-	/*
-	 * Mock PersistenceDelegate subclass.
-	 */
-	static class MockPersistenceDelegate extends PersistenceDelegate {
-		private boolean filter = false;
-
-		private boolean mutatesToResult = true;
-
-		public MockPersistenceDelegate() {
-			// empty
-		}
-
-		public MockPersistenceDelegate(boolean mutatesToResult, boolean filter) {
-			this.mutatesToResult = mutatesToResult;
-			this.filter = filter;
-		}
-
-		public void setMutatesToResult(boolean ret) {
-			this.mutatesToResult = ret;
-		}
-
-		public Expression instantiate(Object oldInstance, Encoder out) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (!this.filter
-					|| eles[2].getClassName().equals(this.getClass().getName())) {
-				CallVerificationStack.getInstance().push(oldInstance);
-				CallVerificationStack.getInstance().push(out);
-			}
-			return new Expression(oldInstance, MockFoo.class, "new", null);
-		}
-
-		public void initialize(Class type, Object oldInstance,
-				Object newInstance, Encoder enc) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (!this.filter
-					|| eles[2].getClassName().equals(this.getClass().getName())) {
-				CallVerificationStack.getInstance().push(type);
-				CallVerificationStack.getInstance().push(oldInstance);
-				CallVerificationStack.getInstance().push(newInstance);
-				CallVerificationStack.getInstance().push(enc);
-			}
-		}
-
-		public boolean mutatesTo(Object oldInstance, Object newInstance) {
-			StackTraceElement[] eles = (new Throwable()).getStackTrace();
-			if (!this.filter
-					|| eles[2].getClassName().equals(this.getClass().getName())) {
-				CallVerificationStack.getInstance().push(oldInstance);
-				CallVerificationStack.getInstance().push(newInstance);
-			}
-			return this.mutatesToResult;
-		}
-
-		public void writeObject(Object oldInstance, Encoder enc) {
-			// CallVerificationStack.getInstance().push(oldInstance);
-			// CallVerificationStack.getInstance().push(enc);
-			super.writeObject(oldInstance, enc);
-		}
-
-	}
-
-	/*
-	 * Dummy PersistenceDelegate subclass.
-	 */
-	static class DummyPersistenceDelegate extends PersistenceDelegate {
-		public Expression instantiate(Object oldInstance, Encoder out) {
-			return new Expression(oldInstance.getClass(), "new", null);
-		}
-
-		public void initialize(Class type, Object oldInstance,
-				Object newInstance, Encoder enc) {
-			super.initialize(type, oldInstance, newInstance, enc);
-		}
-
-		public boolean mutatesTo(Object oldInstance, Object newInstance) {
-			return super.mutatesTo(oldInstance, newInstance);
-		}
-
-		public void writeObject(Object oldInstance, Encoder enc) {
-			super.writeObject(oldInstance, enc);
-		}
-
-	}
-
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.Encoder;
+import java.beans.ExceptionListener;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.Statement;
+
+import junit.framework.TestCase;
+import org.apache.harmony.beans.tests.java.beans.mock.MockFoo;
+import org.apache.harmony.beans.tests.java.beans.mock.MockFooStop;
+import tests.util.CallVerificationStack;
+
+/**
+ * Test java.beans.PersistenceDelegate
+ */
+public class PersistenceDelegateTest extends TestCase {
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		CallVerificationStack.getInstance().clear();
+	}
+
+	/*
+	 * Test the constructor.
+	 */
+	public void testConstructor() {
+		new DummyPersistenceDelegate();
+	}
+
+	/*
+	 * Tests writeObject() under normal condition when mutatesTo() returns True.
+	 */
+	public void testWriteObject_NormalMutatesToTrue() {
+		MockPersistenceDelegate pd = new MockPersistenceDelegate(true, true);
+		MockEncoder enc = new MockEncoder();
+		MockFoo oldInstance = new MockFoo();
+		enc.setPersistenceDelegate(MockFooStop.class, pd);
+
+		pd.writeObject(oldInstance, enc);
+
+		// should have called initialize()
+		assertSame(enc, CallVerificationStack.getInstance().pop());
+		assertSame(null, CallVerificationStack.getInstance().pop());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("initialize", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(MockFoo.class, CallVerificationStack.getInstance().pop());
+
+		// should have called mutatesTo()
+		assertSame(null, CallVerificationStack.getInstance().pop());
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("mutatesTo", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+
+		// should have called Encoder.get()
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("get", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+
+		assertTrue(CallVerificationStack.getInstance().empty());
+	}
+
+	/*
+	 * Tests writeObject() under normal condition when mutatesTo() returns
+	 * false.
+	 */
+	public void testWriteObject_NormalMutatesToFalse() {
+		MockPersistenceDelegate pd = new MockPersistenceDelegate(false, true);
+		MockEncoder enc = new MockEncoder();
+		MockFoo oldInstance = new MockFoo();
+		enc.setPersistenceDelegate(MockFooStop.class, pd);
+
+		pd.writeObject(oldInstance, enc);
+
+		// should have called writeExpression()
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("writeExpression", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertTrue(CallVerificationStack.getInstance().pop() instanceof Expression);
+
+		// should have called instantiate()
+		assertSame(enc, CallVerificationStack.getInstance().pop());
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("instantiate", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+
+		// should have called Encoder.remove()
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("remove", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+
+		// should have called mutatesTo()
+		assertSame(null, CallVerificationStack.getInstance().pop());
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("mutatesTo", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+
+		// should have called Encoder.get()
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockEncoder",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("get", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(oldInstance, CallVerificationStack.getInstance().pop());
+
+		assertTrue(CallVerificationStack.getInstance().empty());
+	}
+
+	/*
+	 * Tests writeObject() when object is null.
+	 */
+	public void testWriteObject_NullObject() {
+		MockPersistenceDelegate pd = new MockPersistenceDelegate();
+		MockEncoder enc = new MockEncoder();
+		enc.setPersistenceDelegate(MockFooStop.class, pd);
+
+		try {
+			pd.writeObject(null, enc);
+			fail("Should throw NullPointerException!");
+		} catch (NullPointerException ex) {
+			// expected
+		}
+	}
+
+	/*
+	 * Tests writeObject() when encoder is null.
+	 */
+	public void testWriteObject_NullEncoder() {
+		MockPersistenceDelegate pd = new MockPersistenceDelegate();
+		MockEncoder enc = new MockEncoder();
+		enc.setPersistenceDelegate(MockFooStop.class, pd);
+
+		try {
+			pd.writeObject(new MockFoo(), null);
+			fail("Should throw NullPointerException!");
+		} catch (NullPointerException ex) {
+			// expected
+		}
+	}
+
+	/*
+	 * Tests initialize() under normal conditions.
+	 */
+	public void testInitialize_Normal() {
+		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
+		Encoder enc = new Encoder();
+		Object o1 = new Object();
+		Object o2 = new Object();
+		enc.setPersistenceDelegate(MockFooStop.class,
+				new MockPersistenceDelegate());
+		pd.initialize(MockFoo.class, o1, o2, enc);
+		assertSame(enc, CallVerificationStack.getInstance().pop());
+		assertSame(o2, CallVerificationStack.getInstance().pop());
+		assertSame(o1, CallVerificationStack.getInstance().pop());
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("initialize", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(MockFooStop.class, CallVerificationStack.getInstance().pop());
+		assertTrue(CallVerificationStack.getInstance().empty());
+		// test interface
+		o1 = new MockObject();
+		enc.setPersistenceDelegate(MockInterface.class,
+				new MockPersistenceDelegate());
+		pd.initialize(MockObject.class, o1, o1, enc);
+		assertTrue(CallVerificationStack.getInstance().empty());
+	}
+
+	/*
+	 * Tests initialize() with null class.
+	 */
+	public void testInitialize_NullClass() {
+		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
+		Encoder enc = new Encoder();
+		Object o1 = new Object();
+		Object o2 = new Object();
+		enc.setPersistenceDelegate(MockFooStop.class,
+				new MockPersistenceDelegate());
+		try {
+			pd.initialize(null, o1, o2, enc);
+			fail("Should throw NullPointerException!");
+		} catch (NullPointerException ex) {
+			// expected
+		}
+	}
+
+	/*
+	 * Tests initialize() with null old and new instances.
+	 */
+	public void testInitialize_NullInstances() {
+		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
+		Encoder enc = new Encoder();
+		enc.setPersistenceDelegate(MockFooStop.class,
+				new MockPersistenceDelegate());
+		pd.initialize(MockFoo.class, null, null, enc);
+		assertSame(enc, CallVerificationStack.getInstance().pop());
+		assertSame(null, CallVerificationStack.getInstance().pop());
+		assertSame(null, CallVerificationStack.getInstance().pop());
+		assertEquals(
+				"org.apache.harmony.beans.tests.java.beans.PersistenceDelegateTest$MockPersistenceDelegate",
+				CallVerificationStack.getInstance().getCurrentSourceClass());
+		assertEquals("initialize", CallVerificationStack.getInstance()
+				.getCurrentSourceMethod());
+		assertSame(MockFooStop.class, CallVerificationStack.getInstance().pop());
+		assertTrue(CallVerificationStack.getInstance().empty());
+	}
+
+	/*
+	 * Tests initialize() with null encoder.
+	 */
+	public void testInitialize_NullEncoder() {
+		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
+		Object o1 = new Object();
+		Object o2 = new Object();
+		try {
+			pd.initialize(MockFoo.class, o1, o2, null);
+			fail("Should throw NullPointerException!");
+		} catch (NullPointerException ex) {
+			// expected
+		}
+	}
+
+	/*
+	 * Tests mutatesTo() under normal conditions.
+	 */
+	public void testMutatesTo_Normal() {
+		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
+		assertTrue(pd.mutatesTo("test1", "test2"));
+		assertFalse(pd.mutatesTo(new Object(), new Object() {
+			public int hashCode() {
+				return super.hashCode();
+			}
+		}));
+		assertFalse(pd.mutatesTo(new MockFoo(), new MockFooStop()));
+		// DummyEncoder enc = new DummyEncoder();
+		// pd.writeObject(new MockFoo(), enc);
+	}
+
+	/*
+	 * Tests mutatesTo() with null parameters.
+	 */
+	public void testMutatesTo_Null() {
+		DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
+		assertFalse(pd.mutatesTo("test", null));
+		assertFalse(pd.mutatesTo(null, null));
+		try {
+			pd.mutatesTo(null, "test");
+			fail("Should throw NullPointerException!");
+		} catch (NullPointerException ex) {
+			// expected
+		}
+	}
+
+	/*
+	 * Mock interface.
+	 */
+	static interface MockInterface {
+
+	}
+
+	/*
+	 * Mock interface.
+	 */
+	static class MockObject implements MockInterface {
+
+	}
+
+	/*
+	 * Mock Encoder.
+	 */
+	static class MockEncoder extends Encoder {
+
+		public Object get(Object oldInstance) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (eles[2].getClassName().equals(
+					MockPersistenceDelegate.class.getName())) {
+				CallVerificationStack.getInstance().push(oldInstance);
+			}
+			return super.get(oldInstance);
+		}
+
+		public ExceptionListener getExceptionListener() {
+			return super.getExceptionListener();
+		}
+
+		public PersistenceDelegate getPersistenceDelegate(Class type) {
+			return super.getPersistenceDelegate(type);
+		}
+
+		public Object remove(Object oldInstance) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (eles[2].getClassName().equals(
+					MockPersistenceDelegate.class.getName())) {
+				CallVerificationStack.getInstance().push(oldInstance);
+			}
+			return super.remove(oldInstance);
+		}
+
+		public void setExceptionListener(ExceptionListener exceptionListener) {
+			super.setExceptionListener(exceptionListener);
+		}
+
+		public void setPersistenceDelegate(Class type,
+				PersistenceDelegate persistenceDelegate) {
+			super.setPersistenceDelegate(type, persistenceDelegate);
+		}
+
+		public void writeExpression(Expression oldExp) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (eles[2].getClassName().equals(
+					MockPersistenceDelegate.class.getName())) {
+				CallVerificationStack.getInstance().push(oldExp);
+			}
+			super.writeExpression(oldExp);
+		}
+
+		public void writeStatement(Statement oldStm) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (eles[2].getClassName().equals(
+					MockPersistenceDelegate.class.getName())) {
+				CallVerificationStack.getInstance().push(oldStm);
+			}
+			super.writeStatement(oldStm);
+		}
+
+		public void writeObject(Object o) {
+			super.writeObject(o);
+		}
+	}
+
+	/*
+	 * Mock PersistenceDelegate subclass.
+	 */
+	static class MockPersistenceDelegate extends PersistenceDelegate {
+		private boolean filter = false;
+
+		private boolean mutatesToResult = true;
+
+		public MockPersistenceDelegate() {
+			// empty
+		}
+
+		public MockPersistenceDelegate(boolean mutatesToResult, boolean filter) {
+			this.mutatesToResult = mutatesToResult;
+			this.filter = filter;
+		}
+
+		public void setMutatesToResult(boolean ret) {
+			this.mutatesToResult = ret;
+		}
+
+		public Expression instantiate(Object oldInstance, Encoder out) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (!this.filter
+					|| eles[2].getClassName().equals(this.getClass().getName())) {
+				CallVerificationStack.getInstance().push(oldInstance);
+				CallVerificationStack.getInstance().push(out);
+			}
+			return new Expression(oldInstance, MockFoo.class, "new", null);
+		}
+
+		public void initialize(Class type, Object oldInstance,
+				Object newInstance, Encoder enc) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (!this.filter
+					|| eles[2].getClassName().equals(this.getClass().getName())) {
+				CallVerificationStack.getInstance().push(type);
+				CallVerificationStack.getInstance().push(oldInstance);
+				CallVerificationStack.getInstance().push(newInstance);
+				CallVerificationStack.getInstance().push(enc);
+			}
+		}
+
+		public boolean mutatesTo(Object oldInstance, Object newInstance) {
+			StackTraceElement[] eles = (new Throwable()).getStackTrace();
+			if (!this.filter
+					|| eles[2].getClassName().equals(this.getClass().getName())) {
+				CallVerificationStack.getInstance().push(oldInstance);
+				CallVerificationStack.getInstance().push(newInstance);
+			}
+			return this.mutatesToResult;
+		}
+
+		public void writeObject(Object oldInstance, Encoder enc) {
+			// CallVerificationStack.getInstance().push(oldInstance);
+			// CallVerificationStack.getInstance().push(enc);
+			super.writeObject(oldInstance, enc);
+		}
+
+	}
+
+	/*
+	 * Dummy PersistenceDelegate subclass.
+	 */
+	static class DummyPersistenceDelegate extends PersistenceDelegate {
+		public Expression instantiate(Object oldInstance, Encoder out) {
+			return new Expression(oldInstance.getClass(), "new", null);
+		}
+
+		public void initialize(Class type, Object oldInstance,
+				Object newInstance, Encoder enc) {
+			super.initialize(type, oldInstance, newInstance, enc);
+		}
+
+		public boolean mutatesTo(Object oldInstance, Object newInstance) {
+			return super.mutatesTo(oldInstance, newInstance);
+		}
+
+		public void writeObject(Object oldInstance, Encoder enc) {
+			super.writeObject(oldInstance, enc);
+		}
+
+	}
+
+}



Mime
View raw message