You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/10/08 19:35:47 UTC

svn commit: r454179 - /incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java

Author: ndbeyer
Date: Sun Oct  8 10:35:47 2006
New Revision: 454179

URL: http://svn.apache.org/viewvc?view=rev&rev=454179
Log:
Apply patch for HARMONY-1764: [classlib][beans] rework of EventHandlerTest; cleanup imports as well

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java?view=diff&rev=454179&r1=454178&r2=454179
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java Sun Oct  8 10:35:47 2006
@@ -23,17 +23,14 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
-import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.util.EventListener;
 import java.util.EventObject;
-
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
-
 import org.apache.harmony.beans.tests.support.SampleEvent;
 import org.apache.harmony.beans.tests.support.SampleListener;
 import org.apache.harmony.beans.tests.support.mock.MockButton;
@@ -131,7 +128,7 @@
 
         Method m = SampleListener.class.getMethod("fireSampleEvent",
                 new Class[] { SampleEvent.class });
-        handler.invoke(proxy, m, null);
+        handler.invoke(proxy, m, new Object[] {new SampleEvent("")});
 
         assertEquals(invocationObject, handler.getTarget());
         assertEquals("doSomething", getMethodName());
@@ -227,10 +224,10 @@
      * 
      */
     public static Test suite() {
-        // TestSuite suite = new TestSuite();
-        // suite.addTest(new
-        // EventHandlerTest("testCreateForStaticMethodAsPropertyGetter"));
-        // return suite;
+//         TestSuite suite = new TestSuite();
+//         
+//         suite.addTest(new EventHandlerTest("testInvokeWithNullPropertyName"));
+//         return suite;
         return new TestSuite(EventHandlerTest.class);
     }
 
@@ -423,8 +420,8 @@
         String newLabel = "New Value: set text.";
         try {
             button.setLabel(newLabel);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
+            fail("Should throw RuntimeException.");
+        } catch (RuntimeException e) {
         }
     }
 
@@ -463,7 +460,7 @@
         try {
             button.setLabel(newLabel);
             fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
+        } catch (RuntimeException e) {
         }
     }
 
@@ -506,10 +503,10 @@
     public void testCreateClassObjectStringStringString_ClassInvalid() {
         MockTarget target = new MockTarget();
         try {
-            EventHandler.create(Serializable.class, target, "text",
+            EventHandler.create(String.class, target, "text",
                     "source.label", "propertyChange");
-            fail("Should throw ClassCastException.");
-        } catch (ClassCastException e) {
+            fail("Should throw IllegalArgumentException.");
+        } catch (IllegalArgumentException e) {
         }
     }
 
@@ -560,8 +557,8 @@
         String newLabel = "New Value: set text.";
         try {
             button.setLabel(newLabel);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
+            fail("Should throw RuntimeException.");
+        } catch (RuntimeException e) {
         }
     }
 
@@ -600,8 +597,8 @@
         String newLabel = "New Value: set text.";
         try {
             button.setLabel(newLabel);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
+            fail("Should throw RuntimeException.");
+        } catch (RuntimeException e) {
         }
     }
 
@@ -751,8 +748,8 @@
         String newLabel = "New Value: set text.";
         try {
             button.setLabel(newLabel);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
+            fail("Should throw RuntimeException.");
+        } catch (RuntimeException e) {
 
         }
     }
@@ -768,8 +765,8 @@
         String newLabel = "New Value: set text.";
         try {
             button.setLabel(newLabel);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
+            fail("Should throw RuntimeException.");
+        } catch (RuntimeException e) {
         }
 
     }