harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r428668 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/Expression.java test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java
Date Fri, 04 Aug 2006 08:51:23 GMT
Author: mloenko
Date: Fri Aug  4 01:51:22 2006
New Revision: 428668

URL: http://svn.apache.org/viewvc?rev=428668&view=rev
Log:
applied patch for HARMONY-1061
[classlib][beans] tests from ExpressionTest fail on RI

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java?rev=428668&r1=428667&r2=428668&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/Expression.java
Fri Aug  4 01:51:22 2006
@@ -57,10 +57,21 @@
      */
     public String toString() {
         try {
-            Object resultValue = getValue();
-            String result = (resultValue == null) ? "<null>"
-                    : convertClassName(resultValue.getClass());
-            return result + "=" + super.toString();
+            StringBuilder sb = new StringBuilder();
+            
+            if (!valueIsDefined) {
+                sb.append("<unbound>");
+            } else {
+                if (value == null) {
+                    sb.append("null");
+                } else {
+                    sb.append(convertClassName(value.getClass()));
+                }
+            }
+            sb.append('=');
+            sb.append(super.toString());
+            
+            return sb.toString();
         } catch(Exception e) {
             return new String("Error in expression: " + e.getClass());
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java?rev=428668&r1=428667&r2=428668&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java
Fri Aug  4 01:51:22 2006
@@ -115,7 +115,7 @@
         assertSame(arg3, t.getArguments()[2]);
         assertSame(arg4, t.getArguments()[3]);
 
-        assertEquals("String=ExpressionTest$MockParent.method(" +
+        assertEquals("<unbound>=ExpressionTest$MockParent.method(" +
                 "\"string1\", Object, \"string3\", Integer);", t.toString());
     }
 
@@ -147,7 +147,7 @@
         assertSame(oa, t.getArguments());
         assertSame(arg, t.getArguments()[0]);
         
-        assertEquals("String=ExpressionTest$MockParent.method(Object);",
+        assertEquals("<unbound>=ExpressionTest$MockParent.method(Object);",
                 t.toString());
     }
 
@@ -176,7 +176,7 @@
         assertSame("new", t.getMethodName());
         assertSame(oa, t.getArguments());
 
-        assertEquals("ExpressionTest$MockObject=Class.new(Object);",
+        assertEquals("<unbound>=Class.new(Object);",
                 t.toString());
     }
 
@@ -204,7 +204,7 @@
         assertSame("method", t.getMethodName());
         assertEquals(0, t.getArguments().length);
 
-        assertEquals("String=ExpressionTest$MockParent.method();",
+        assertEquals("<unbound>=ExpressionTest$MockParent.method();",
                 t.toString());
     }
 
@@ -221,7 +221,7 @@
         assertSame(oa, t.getArguments());
         assertNull(t.getArguments()[0]);
 
-        assertEquals("String=ExpressionTest$MockParent.method(null);",
+        assertEquals("<unbound>=ExpressionTest$MockParent.method(null);",
                 t.toString());
     }
 
@@ -387,7 +387,7 @@
         assertSame(oa, t.getArguments());
         assertNull(t.getArguments()[0]);
 
-        assertEquals("<null>=Object.method(null);", t.toString());
+        assertEquals("null=Object.method(null);", t.toString());
     }
 
     /*
@@ -776,8 +776,8 @@
         MockObject mo = new MockObject(false);
         Object[] arguments = new Object[] { new Integer(1) };
         Expression t = new Expression(mo, "methodB", arguments);
-        assertEquals("methodB1", t.getValue());
-        MockObject.assertCalled("methodB1", arguments);
+        assertEquals("methodB2", t.getValue());
+        MockObject.assertCalled("methodB2", arguments);
 
         arguments = new Object[] { Boolean.FALSE };
         t = new Expression(mo, "methodB", arguments);
@@ -835,14 +835,14 @@
      * 
      * Note: decided by definition position! should be ambiguous.
      */
-    public void testGetValue_EqualSpecificMethods() throws Exception {
-        MockObject mo = new MockObject(false);
-        Object[] arguments = new Object[] { new MockObject(false),
-                new MockObject(false) };
-        Expression t = new Expression(mo, "equalSpecificMethod", arguments);
-        assertEquals("equalSpecificMethod1", t.getValue());
-        MockObject.assertCalled("equalSpecificMethod1", arguments);
-    }
+//    public void testGetValue_EqualSpecificMethods() throws Exception {
+//        MockObject mo = new MockObject(false);
+//        Object[] arguments = new Object[] { new MockObject(false),
+//                new MockObject(false) };
+//        Expression t = new Expression(mo, "equalSpecificMethod", arguments);
+//        assertEquals("equalSpecificMethod1", t.getValue());
+//        MockObject.assertCalled("equalSpecificMethod1", arguments);
+//    }
 
     /*
      * Test the method getValue() with two equal specific methods but one
@@ -850,14 +850,14 @@
      * 
      * Note: decided by definition position! should call the one with exception.
      */
-    public void testGetValue_EqualSpecificMethodsException() throws Exception {
-        MockObject mo = new MockObject(false);
-        Object[] arguments = new Object[] { new MockObject(false),
-                new MockObject(false), new Object() };
-        Expression t = new Expression(mo, "equalSpecificMethod", arguments);
-        assertEquals("equalSpecificMethod3", t.getValue());
-        MockObject.assertCalled("equalSpecificMethod3", arguments);
-    }
+//    public void testGetValue_EqualSpecificMethodsException() throws Exception {
+//        MockObject mo = new MockObject(false);
+//        Object[] arguments = new Object[] { new MockObject(false),
+//                new MockObject(false), new Object() };
+//        Expression t = new Expression(mo, "equalSpecificMethod", arguments);
+//        assertEquals("equalSpecificMethod3", t.getValue());
+//        MockObject.assertCalled("equalSpecificMethod3", arguments);
+//    }
 
     /*
      * Super class of MockObject.
@@ -969,12 +969,12 @@
             throw new NullPointerException();
         }
 
-        public Object methodB(Integer i) {
-            reset();
-            calledMethod = "methodB1";
-            receivedArguments.add(i);
-            return calledMethod;
-        }
+//        public Object methodB(Integer i) {
+//            reset();
+//            calledMethod = "methodB1";
+//            receivedArguments.add(i);
+//            return calledMethod;
+//        }
 
         public Object methodB(int i) {
             reset();
@@ -1017,40 +1017,40 @@
             return calledMethod;
         }
 
-        public Object equalSpecificMethod(MockObject o, MockParent p) {
-            reset();
-            calledMethod = "equalSpecificMethod1";
-            receivedArguments.add(o);
-            receivedArguments.add(p);
-            return calledMethod;
-        }
-
-        public Object equalSpecificMethod(MockParent p, MockObject o) {
-            reset();
-            calledMethod = "equalSpecificMethod2";
-            receivedArguments.add(p);
-            receivedArguments.add(o);
-            return calledMethod;
-        }
-
-        public Object equalSpecificMethod(MockObject o, MockParent p, Object o2) {
-            reset();
-            calledMethod = "equalSpecificMethod3";
-            receivedArguments.add(o);
-            receivedArguments.add(p);
-            receivedArguments.add(o2);
-            return calledMethod;
-        }
-
-        public Object equalSpecificMethod(MockParent p, MockObject o, Object o2)
-                throws Exception {
-            reset();
-            calledMethod = "equalSpecificMethod4";
-            receivedArguments.add(p);
-            receivedArguments.add(o);
-            receivedArguments.add(o2);
-            return calledMethod;
-        }
+//        public Object equalSpecificMethod(MockObject o, MockParent p) {
+//            reset();
+//            calledMethod = "equalSpecificMethod1";
+//            receivedArguments.add(o);
+//            receivedArguments.add(p);
+//            return calledMethod;
+//        }
+
+//        public Object equalSpecificMethod(MockParent p, MockObject o) {
+//            reset();
+//            calledMethod = "equalSpecificMethod2";
+//            receivedArguments.add(p);
+//            receivedArguments.add(o);
+//            return calledMethod;
+//        }
+
+//        public Object equalSpecificMethod(MockObject o, MockParent p, Object o2) {
+//            reset();
+//            calledMethod = "equalSpecificMethod3";
+//            receivedArguments.add(o);
+//            receivedArguments.add(p);
+//            receivedArguments.add(o2);
+//            return calledMethod;
+//        }
+
+//        public Object equalSpecificMethod(MockParent p, MockObject o, Object o2)
+//                throws Exception {
+//            reset();
+//            calledMethod = "equalSpecificMethod4";
+//            receivedArguments.add(p);
+//            receivedArguments.add(o);
+//            receivedArguments.add(o2);
+//            return calledMethod;
+//        }
 
         public static Class forName(String o) {
             reset();



Mime
View raw message