harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r575521 - in /harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/NullPersistenceDelegate.java test/java-internal/java/beans/NullPersistenceDelegateTest.java
Date Fri, 14 Sep 2007 03:30:52 GMT
Author: tonywu
Date: Thu Sep 13 20:30:52 2007
New Revision: 575521

URL: http://svn.apache.org/viewvc?rev=575521&view=rev
Log:
Apply patch Harmony-4792 ([classlib][beans] NullPersistenceDelegate.instantiate(Object, Encoder)
should return null)

Added:
    harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/NullPersistenceDelegateTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java?rev=575521&r1=575520&r2=575521&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/NullPersistenceDelegate.java
Thu Sep 13 20:30:52 2007
@@ -20,8 +20,7 @@
 class NullPersistenceDelegate extends PersistenceDelegate {
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        assert oldInstance == null;
-        return new Expression(null, null, null, null);
+        return null;
     }
 
     @Override
@@ -36,7 +35,6 @@
 
     @Override
     public void writeObject(Object oldInstance, Encoder out) {
-        assert oldInstance == null;
-        out.writeExpression(instantiate(null, out));
+        // do nothing
     }
 }

Added: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/NullPersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/NullPersistenceDelegateTest.java?rev=575521&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/NullPersistenceDelegateTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/NullPersistenceDelegateTest.java
Thu Sep 13 20:30:52 2007
@@ -0,0 +1,71 @@
+/* 
+ * 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.
+ */
+
+package java.beans;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the internal class java.beans.NullPersistenceDelegate.
+ */
+public class NullPersistenceDelegateTest extends TestCase {
+    
+    private PersistenceDelegate pd = null;
+    
+    private Encoder enc = null;
+    
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        enc = new Encoder();
+        pd = enc.getPersistenceDelegate(null);
+    }
+    
+    public void test_instantiate_LObject_LEncoder() throws Exception {
+        Expression exp = pd.instantiate(null, enc);
+        assertNull(exp);
+        
+        exp = pd.instantiate(new Object(), enc);
+        assertNull(exp);
+        
+        exp = pd.instantiate(null, null);
+        assertNull(exp);
+        
+        exp = pd.instantiate(new Object(), null);
+        assertNull(exp);
+    }
+    
+    public void test_mutatesTo_LObject_Object() {
+        assertFalse(pd.mutatesTo(null, null));
+        assertFalse(pd.mutatesTo(null, new Object()));
+        assertFalse(pd.mutatesTo(new Object(), null));
+
+        Object o = new Object();
+        assertTrue(pd.mutatesTo(o, o));
+        assertTrue(pd.mutatesTo(new Object(), new Object()));
+        assertFalse(pd.mutatesTo(new Object(), new Integer(1)));
+    }
+    
+    public void test_writeObject_LObject_LEncoder() {
+        pd.writeObject(null, null);
+    }
+    
+    public void test_initialize() {
+        pd.initialize(null, null, null, null);
+    }
+    
+}

Propchange: harmony/enhanced/classlib/trunk/modules/beans/src/test/java-internal/java/beans/NullPersistenceDelegateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message