harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r417685 [2/15] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans: ./ make/ src/test/java/org/apache/harmony/beans/tests/java/beans/ src/test/java/org/apache/harmony/beans/tests/java/beans/auxiliary/ src/test/java/org/apache/harm...
Date Wed, 28 Jun 2006 07:22:23 GMT
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?rev=417685&r1=417684&r2=417685&view=diff
==============================================================================
--- 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 Wed Jun 28 00:22:12 2006
@@ -31,12 +31,10 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
-import org.apache.harmony.beans.tests.java.beans.mock.MockButton;
-
-import org.apache.harmony.beans.tests.java.beans.auxiliary.InvocationObject;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.SampleEvent;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.SampleListener;
 
+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;
 
 /**
  * Unit test for EventHandler.
@@ -44,990 +42,909 @@
 public class EventHandlerTest extends TestCase {
 
     private Object object;
+
     private String methodName;
+
     private Object[] params;
-    
+
     private String text = "something";
-    
+
     /**
      * 
      */
     public EventHandlerTest() {
         super();
     }
-    
+
     /**
-     *
+     * 
      */
     public EventHandlerTest(String name) {
         super(name);
     }
-    
+
     /**
      * The test checks event handler accessors
      */
     public void testAccessors() {
-        InvocationObject invocationObject = new InvocationObject(this);
-        EventHandler handler = new EventHandler(
-            invocationObject, "someText", "source.text", "actionPerformed" );
+        InvocationObject invocationObject = new InvocationObject();
+        EventHandler handler = new EventHandler(invocationObject, "someText",
+                "source.text", "actionPerformed");
         assertEquals(invocationObject, handler.getTarget());
         assertEquals("someText", handler.getAction());
         assertEquals("source.text", handler.getEventPropertyName());
         assertEquals("actionPerformed", handler.getListenerMethodName());
     }
-    
+
     /**
      * The test checks the method invoke() with null listener value
      */
-    public void testNullListenerMethodName() {
-        InvocationObject invocationObject = new InvocationObject(this);
-        
-        EventHandler handler = new EventHandler(
-            invocationObject, "someText", "source.text", null );
-        
+    public void testNullListenerMethodName() throws Exception {
+        InvocationObject invocationObject = new InvocationObject();
+
+        EventHandler handler = new EventHandler(invocationObject, "someText",
+                "source.text", null);
+
         Object proxy = EventHandler.create(ActionListener.class,
-            invocationObject, "someText", "source.text");
+                invocationObject, "someText", "source.text");
 
-        Method m = null;
-        try {
-            m = ActionListener.class.getMethod("actionPerformed",
-                    new Class[] { ActionEvent.class } );
-            Object result = handler.invoke(proxy, m,
-                    new Object[] { new ActionEvent(this, 0, "") } );
-            
-            assertEquals(invocationObject.getSomeText(), getText());
-        } catch (Exception e) {
-            fail("Method actionPerformed not found in interface");
-        }
+        Method m = ActionListener.class.getMethod("actionPerformed",
+                new Class[] { ActionEvent.class });
+        handler.invoke(proxy, m, new Object[] { new ActionEvent(this, 0, "") });
+
+        assertEquals(invocationObject.getSomeText(), getText());
     }
-    
+
     /**
      * The test checks the method invoke()
      */
-    public void testInvoke() {
-        InvocationObject invocationObject = new InvocationObject(this);
-        
-        EventHandler handler = new EventHandler(
-            invocationObject, "someText", "source.text", "actionPerformed" );
-        
+    public void testInvoke() throws Exception {
+        InvocationObject invocationObject = new InvocationObject();
+
+        EventHandler handler = new EventHandler(invocationObject, "someText",
+                "source.text", "actionPerformed");
+
         Object proxy = EventHandler.create(ActionListener.class,
-            invocationObject, "someText", "source.text");
+                invocationObject, "someText", "source.text");
 
-        Method m = null;
-        try {
-            m = ActionListener.class.getMethod("actionPerformed",
-                    new Class[] { ActionEvent.class } );
-            Object result = handler.invoke(proxy, m,
-                    new Object[] { new ActionEvent(this, 0, "") } );
-            
-            assertEquals(invocationObject, handler.getTarget());
-            assertEquals(invocationObject.getSomeText(), getText());
-        } catch (Exception e) {
-            fail("Method actionPerformed not found in interface");
-        }
+        Method m = ActionListener.class.getMethod("actionPerformed",
+                new Class[] { ActionEvent.class });
+        handler.invoke(proxy, m, new Object[] { new ActionEvent(this, 0, "") });
+
+        assertEquals(invocationObject, handler.getTarget());
+        assertEquals(invocationObject.getSomeText(), getText());
     }
-    
+
     /**
      * The test checks the method invoke() with null property name
      */
-    public void testInvokeWithNullPropertyName() {
-        InvocationObject invocationObject = new InvocationObject(this);
-        
-        EventHandler handler = new EventHandler(
-            invocationObject, "doSomething", null, null );
-        
+    public void testInvokeWithNullPropertyName() throws Exception {
+        InvocationObject invocationObject = new InvocationObject();
+
+        EventHandler handler = new EventHandler(invocationObject,
+                "doSomething", null, null);
+
         Object proxy = EventHandler.create(SampleListener.class,
                 invocationObject, "doSomething");
 
-        try {
-            Method m = SampleListener.class.getMethod(
-                "fireSampleEvent", new Class[] { SampleEvent.class } );
-            Object result = handler.invoke(proxy, m, null);
-            
-            assertEquals(invocationObject, handler.getTarget());
-            assertEquals("doSomething", getMethodName());
-        } catch (Exception e) {
-            fail("Method doSomething not found in interface");
-        }
+        Method m = SampleListener.class.getMethod("fireSampleEvent",
+                new Class[] { SampleEvent.class });
+        handler.invoke(proxy, m, null);
+
+        assertEquals(invocationObject, handler.getTarget());
+        assertEquals("doSomething", getMethodName());
     }
-    
+
     /**
      * The test checks the object created with the create() method call
      */
     public void testCreateWithMethodCall() {
-        Object invocationObject = new InvocationObject(this);
-        ActionListener listener = (ActionListener) EventHandler.create(
-            ActionListener.class, invocationObject, "doSomething");
+        Object invocationObject = new InvocationObject();
+        ActionListener listener = EventHandler.create(ActionListener.class,
+                invocationObject, "doSomething");
         listener.actionPerformed(new ActionEvent(this, 0, ""));
-        
+
         assertEquals(getObject(), invocationObject);
         assertEquals("doSomething", getMethodName());
-        
+
         Object[] params = getParams();
-        if(params.length != 0) {
+        if (params.length != 0) {
             fail("Number of params should be 0");
         }
     }
-    
+
     /**
      * The test checks the setter is initialized properly
      */
     public void testCreateWithSetterCall() {
-        Object invocationObject = new InvocationObject(this);
+        Object invocationObject = new InvocationObject();
         ActionEvent ae = new ActionEvent(this, 0, "");
-        ActionListener listener = (ActionListener) EventHandler.create(
-            ActionListener.class, invocationObject, "someObject", "source");
+        ActionListener listener = EventHandler.create(ActionListener.class,
+                invocationObject, "someObject", "source");
         listener.actionPerformed(ae);
-        
+
         assertEquals(getObject(), invocationObject);
         assertEquals("setSomeObject", getMethodName());
-        
+
         Object[] params = getParams();
-        if(params.length != 1) {
-            fail("Number of params should be 1");
-        } else {
-            assertEquals(ae.getSource(), params[0]);
-        }
+        assertEquals("Number of params should be 1", 1, params.length);
+        assertEquals(ae.getSource(), params[0]);
     }
-    
+
     /**
      * The test checks the object created with the create() method call for
      * dot-separated property
      */
     public void testCreateWithDottedParameterCall() {
-        Object invocationObject = new InvocationObject(this);
+        Object invocationObject = new InvocationObject();
         ActionEvent ae = new ActionEvent(this, 0, "");
-        ActionListener listener = (ActionListener) EventHandler.create(
-            ActionListener.class, invocationObject, "someText", "source.text");
+        ActionListener listener = EventHandler.create(ActionListener.class,
+                invocationObject, "someText", "source.text");
         listener.actionPerformed(ae);
-        
+
         assertEquals(getObject(), invocationObject);
         assertEquals("setSomeText", getMethodName());
-        
+
         Object[] params = getParams();
-        if(params.length != 1) {
-            fail("Number of params should be 1");
-        } else {
-            assertEquals(((EventHandlerTest) ae.getSource()).getText(),
-                    params[0]);
-        }
+        assertEquals("Number of params should be 1", 1, params.length);
+        assertEquals(((EventHandlerTest) ae.getSource()).getText(), params[0]);
     }
-    
+
     /**
      * The test checks the event is fired for object created with the create()
      */
     public void testCreateWithMethodCallWhichIsSetter() {
-        InvocationObject invocationObject = new InvocationObject(this);
+        InvocationObject invocationObject = new InvocationObject();
         SampleEvent event = new SampleEvent("bean");
-        
-        SampleListener listener = (SampleListener) EventHandler.create(
-                SampleListener.class,
-            invocationObject, "doSomething", "i", null);
-        
+
+        SampleListener listener = EventHandler.create(SampleListener.class,
+                invocationObject, "doSomething", "i", null);
+
         listener.fireSampleEvent(event);
-        
+
         assertEquals("doSomething", getMethodName());
         assertTrue(event.getI() == invocationObject.getIntValue());
     }
-    
+
     /**
      * fireSampleEvent scenario
      */
     public void testCreateForStaticMethodAsPropertyGetter() {
-        InvocationObject invocationObject = new InvocationObject(this);
+        InvocationObject invocationObject = new InvocationObject();
         SampleEvent event = new SampleEvent("bean");
-        
-        SampleListener listener = (SampleListener) EventHandler.create(
-                SampleListener.class,
-            invocationObject, "someValue", "j");
-        
+
+        SampleListener listener = EventHandler.create(SampleListener.class,
+                invocationObject, "someValue", "j");
+
         listener.fireSampleEvent(event);
-        
+
         assertEquals("setSomeValue", getMethodName());
     }
-    
+
     /**
      * 
      */
     public static Test suite() {
-        //TestSuite suite = new TestSuite();
-        //suite.addTest(new EventHandlerTest("testCreateForStaticMethodAsPropertyGetter"));
-        //return suite;
+        // TestSuite suite = new TestSuite();
+        // suite.addTest(new
+        // EventHandlerTest("testCreateForStaticMethodAsPropertyGetter"));
+        // return suite;
         return new TestSuite(EventHandlerTest.class);
     }
-    
+
     /**
      * 
      */
     public static void main(String[] args) {
         TestRunner.run(suite());
     }
-    
-    public void logMethodCall(
-            Object object, String methodName, Object[] params) {
+
+    public void logMethodCall(Object object, String methodName, Object[] params) {
         this.object = object;
         this.methodName = methodName;
         this.params = params;
     }
-    
+
     public String getText() {
         return text;
     }
-    
+
     private Object getObject() {
         return object;
     }
-    
+
     private String getMethodName() {
         return methodName;
     }
-    
+
     private Object[] getParams() {
         return params;
     }
-    
-    
-    
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/*
-	 * Class under test for Object create(Class, Object, String)
-	 */
-	public void testCreateClassObjectString() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "setCalled");
-		button.addPropertyChangeListener(proxy);
-		button.setLabel("new label value");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-		assertTrue(target.isCalled());
-	}
-
-	/*
-	 * listenerInterface class is null
-	 */
-	public void testCreateClassObjectString_ClassNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(null, target, "setCalled");
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * listenerInterface is not a interface
-	 */
-	public void testCreateClassObjectString_ClassInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(MockButton.class, target, "setCalled");
-			fail("Should throw IllegalArgumentException.");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	/*
-	 * the target object is null
-	 */
-	public void testCreateClassObjectString_ObjectNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(PropertyChangeListener.class, null, "setCalled");
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * the target's method is null
-	 */
-	public void testCreateClassObjectString_MethodNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, null);
-		button.addPropertyChangeListener(proxy);
-		try {
-			button.setLabel("new label value");
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-	}
-
-	/*
-	 * the target's method is invalid
-	 */
-	public void testCreateClassObjectString_MethodEmpty() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "");
-		button.addPropertyChangeListener(proxy);
-		try {
-			button.setLabel("new label value");
-			fail("Should throw IndexOutOfBoundsException.");
-		} catch (IndexOutOfBoundsException e) {
-		}
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-	}
-
-	/*
-	 * Class under test for Object create(Class, Object, String, String)
-	 */
-	public void testCreateClassObjectStringString() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text",
-						"source.label");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		button.setLabel(newLabel);
-		assertEquals(MockButton.defaultName, target.getText());
-		button.setLabel("New Value: set text2.");
-		assertEquals(newLabel, target.getText());
-	}
-
-	/*
-	 * listenerInterface is null
-	 */
-	public void testCreateClassObjectStringString_ClassNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(null, target, "text", "source.label");
-			fail("Should throw NullPointerException");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * the target object is null
-	 */
-	public void testCreateClassObjectStringString_TargetNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(PropertyChangeListener.class, null, "text",
-							"source.label");
-			fail("Should throw NullPointerException");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * the action is null
-	 */
-	public void testCreateClassObjectStringString_ActionNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, null,
-						"source.label");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * action is invalid
-	 */
-	public void testCreateClassObjectStringString_ActionInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "action_invalid",
-						"source.label");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * propertyname is null
-	 */
-	public void testCreateClassObjectStringString_PropertyNameNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text", null);
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (Exception e) {
-		}
-	}
-
-	/*
-	 * property name is invalid
-	 */
-	public void testCreateClassObjectStringString_PropertyNameInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text",
-						"source.label_invalid");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * Class under test for Object create(Class, Object, String, String, String)
-	 */
-	public void testCreateClassObjectStringStringString() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text",
-						"source.label", "propertyChange");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		button.setLabel(newLabel);
-		assertEquals(MockButton.defaultName, target.getText());
-		button.setLabel("New Value: set text2.");
-		assertEquals(newLabel, target.getText());
-	}
-
-	/*
-	 * listenerInterface is null
-	 */
-	public void testCreateClassObjectStringStringString_ClassNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(null, target, "text", "source.label",
-							"propertyChange");
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-
-		}
-	}
-
-	/*
-	 * listenerInterface is invalid
-	 */
-	public void testCreateClassObjectStringStringString_ClassInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(Serializable.class, target, "text", "source.label",
-							"propertyChange");
-			fail("Should throw ClassCastException.");
-		} catch (ClassCastException e) {
-		}
-	}
-
-	/*
-	 * the target object is null
-	 */
-	public void testCreateClassObjectStringStringString_TargetNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		try {
-			PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-					.create(PropertyChangeListener.class, null, "text",
-							"source.label", "propertyChange");
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * action is null
-	 */
-	public void testCreateClassObjectStringStringString_ActionNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, null,
-						"source.label", "propertyChange");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * action is invalid
-	 */
-	public void testCreateClassObjectStringStringString_ActionInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text_invalid",
-						"source.label", "propertyChange");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * property name is null
-	 */
-	public void testCreateClassObjectStringStringString_PropertyNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text", null,
-						"propertyChange");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (Exception e) {
-		}
-	}
-
-	/*
-	 * property name is invalid
-	 */
-	public void testCreateClassObjectStringStringString_PropertyInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text",
-						"source.label.invalid", "propertyChange");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * listenerMethodName is null
-	 */
-	public void testCreateClassObjectStringStringString_MethodNull() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text",
-						"source.label", null);
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		button.setLabel(newLabel);
-		assertEquals(MockButton.defaultName, target.getText());
-		button.setLabel("New Value: set text2.");
-		assertEquals(newLabel, target.getText());
-	}
-
-	/*
-	 * listenerMethodName is invalid
-	 */
-	public void testCreateClassObjectStringStringString_MethodInvalid() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "text",
-						"source.label", "propertyChange_invalid");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		button.setLabel(newLabel);
-		assertNull(target.getText());
-	}
-
-	/*
-	 * public EventHandler(Object target, String action, String
-	 * eventPropertyName, String listenerMethodName)
-	 */
-	public void testEventHandler() {
-		MockTarget target = new MockTarget();
-		String action = "text";
-		String eventPropertyName = "source.label";
-		String listenerMethodName = "propertyChange";
-		EventHandler handler = new EventHandler(target, action,
-				eventPropertyName, listenerMethodName);
-		assertSame(target, handler.getTarget());
-		assertSame(action, handler.getAction());
-		assertSame(eventPropertyName, handler.getEventPropertyName());
-		assertSame(listenerMethodName, handler.getListenerMethodName());
-	}
-
-	/*
-	 * target is null
-	 */
-	public void testEventHandler_TargetNull() {
-		String action = "text";
-		String eventPropertyName = "source.label";
-		String listenerMethodName = "propertyChange";
-		EventHandler handler = new EventHandler(null, action,
-				eventPropertyName, listenerMethodName);
-		assertNull(handler.getTarget());
-		assertSame(action, handler.getAction());
-		assertSame(eventPropertyName, handler.getEventPropertyName());
-		assertSame(listenerMethodName, handler.getListenerMethodName());
-	}
-
-	/*
-	 * action is null
-	 */
-	public void testEventHandler_ActionNull() {
-		MockTarget target = new MockTarget();
-		String eventPropertyName = "source.label";
-		String listenerMethodName = "propertyChange";
-		EventHandler handler = new EventHandler(target, null,
-				eventPropertyName, listenerMethodName);
-		assertSame(target, handler.getTarget());
-		assertNull(handler.getAction());
-		assertSame(eventPropertyName, handler.getEventPropertyName());
-		assertSame(listenerMethodName, handler.getListenerMethodName());
-	}
-
-	/*
-	 * EventProperty is null
-	 */
-	public void testEventHandler_EventPropertyNull() {
-		MockTarget target = new MockTarget();
-		String action = "text";
-		String listenerMethodName = "propertyChange";
-		EventHandler handler = new EventHandler(target, action, null,
-				listenerMethodName);
-		assertSame(target, handler.getTarget());
-		assertSame(action, handler.getAction());
-		assertNull(handler.getEventPropertyName());
-		assertSame(listenerMethodName, handler.getListenerMethodName());
-	}
-
-	/*
-	 * Method is null
-	 */
-	public void testEventHandler_MethodNull() {
-		MockTarget target = new MockTarget();
-		String action = "text";
-		String eventPropertyName = "source.label";
-		EventHandler handler = new EventHandler(target, action,
-				eventPropertyName, null);
-		assertSame(target, handler.getTarget());
-		assertSame(action, handler.getAction());
-		assertSame(eventPropertyName, handler.getEventPropertyName());
-		assertNull(handler.getListenerMethodName());
-	}
-
-	public void testInvoke_1() throws SecurityException, NoSuchMethodException {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "setCalled");
-
-		PropertyChangeListener proxy2 = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "setCalled");
-
-		String action = "text";
-		String eventPropertyName = "source.label";
-		EventHandler handler = new EventHandler(target, action,
-				eventPropertyName, null);
-		Method listenerMethod = PropertyChangeListener.class.getMethod(
-				"propertyChange", new Class[] { PropertyChangeEvent.class });
-		PropertyChangeEvent event = new PropertyChangeEvent(button, "label",
-				"1", "5");
-		handler.invoke(proxy, listenerMethod, new Object[] { event });
-		assertEquals(button.getLabel(), target.getText());
-		Method equalsMethod = Object.class.getMethod("equals",
-				new Class[] { Object.class });
-		assertEquals(Boolean.FALSE, handler.invoke(proxy, equalsMethod,
-				new String[] { "mock" }));
-	}
-
-	public void testIncompatibleMethod() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "Text", "source");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-
-		}
-	}
-
-	public void testCoverage_1() {
-		MockTarget target = new MockTarget();
-		MockButton button = new MockButton();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "Text", "");
-		assertTrue(Proxy.isProxyClass(proxy.getClass()));
-
-		button.addPropertyChangeListener(proxy);
-		String newLabel = "New Value: set text.";
-		try {
-			button.setLabel(newLabel);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-
-		}
-
-	}
-
-	public void testInvoke_extend1() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "action1");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("action1", target.getActionRecord());
-	}
-
-	public void testInvoke_extend1_1() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "action4");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		try {
-			support.firePropertyChange(event);
-		} catch (Exception e) {
-
-		}
-		assertEquals("action4", target.getActionRecord());
-	}
-
-	public void testInvoke_extend2() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "action2");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		try {
-			support.firePropertyChange(event);
-			fail("Should throw exception");
-		} catch (Exception e) {
-			// e.printStackTrace();
-		}
-
-	}
-
-	public void testInvoke_extend2_2() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "action3");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-
-		assertEquals("action3", target.getActionRecord());
-	}
-
-	public void testInvoke_extend3() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "a", "source.a");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("boolean:true", target.getActionRecord());
-	}
-
-	public void testInvoke_extend4() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "b", "source.a");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("Boolean:true", target.getActionRecord());
-	}
-
-	public void testInvoke_extend4_BooleanObject() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "a", "source.booleanObject");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("boolean:true", target.getActionRecord());
-	}
-
-	public void testInvoke_extend5() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "int", "source.int");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("int:1", target.getActionRecord());
-	}
-
-	public void testInvoke_extend6() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "char", "source.char");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("char:a", target.getActionRecord());
-	}
-
-	public void testInvoke_extend7() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "byte", "source.byte");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("byte:10", target.getActionRecord());
-	}
-
-	public void testInvoke_extend8() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "short", "source.short");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("short:100", target.getActionRecord());
-	}
-
-	public void testInvoke_extend9() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "long", "source.long");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("long:1000", target.getActionRecord());
-	}
-
-	public void testInvoke_extend10() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "float", "source.float");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("float:2.2", target.getActionRecord());
-	}
-
-	public void testInvoke_extend11() {
-		MockFish fish = new MockFish();
-		MockFishTarget target = new MockFishTarget();
-		PropertyChangeSupport support = new PropertyChangeSupport(fish);
-		Object proxy = EventHandler.create(PropertyChangeListener.class,
-				target, "double", "source.double");
-		support.addPropertyChangeListener((PropertyChangeListener) proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
-				"5");
-		support.firePropertyChange(event);
-		assertEquals("double:3.3", target.getActionRecord());
-	}
+
+    /*
+     * Class under test for Object create(Class, Object, String)
+     */
+    public void testCreateClassObjectString() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "setCalled");
+        button.addPropertyChangeListener(proxy);
+        button.setLabel("new label value");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+        assertTrue(target.isCalled());
+    }
+
+    /*
+     * listenerInterface class is null
+     */
+    public void testCreateClassObjectString_ClassNull() {
+        MockTarget target = new MockTarget();
+        try {
+            EventHandler.create(null, target, "setCalled");
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * listenerInterface is not a interface
+     */
+    public void testCreateClassObjectString_ClassInvalid() {
+        MockTarget target = new MockTarget();
+        try {
+            EventHandler.create(MockButton.class, target, "setCalled");
+            fail("Should throw IllegalArgumentException.");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    /*
+     * the target object is null
+     */
+    public void testCreateClassObjectString_ObjectNull() {
+        try {
+            EventHandler
+                    .create(PropertyChangeListener.class, null, "setCalled");
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * the target's method is null
+     */
+    public void testCreateClassObjectString_MethodNull() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, null);
+        button.addPropertyChangeListener(proxy);
+        try {
+            button.setLabel("new label value");
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+    }
+
+    /*
+     * the target's method is invalid
+     */
+    public void testCreateClassObjectString_MethodEmpty() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "");
+        button.addPropertyChangeListener(proxy);
+        try {
+            button.setLabel("new label value");
+            fail("Should throw IndexOutOfBoundsException.");
+        } catch (IndexOutOfBoundsException e) {}
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+    }
+
+    /*
+     * Class under test for Object create(Class, Object, String, String)
+     */
+    public void testCreateClassObjectStringString() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text", "source.label");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        button.setLabel(newLabel);
+        assertEquals(MockButton.defaultName, target.getText());
+        button.setLabel("New Value: set text2.");
+        assertEquals(newLabel, target.getText());
+    }
+
+    /*
+     * listenerInterface is null
+     */
+    public void testCreateClassObjectStringString_ClassNull() {
+        MockTarget target = new MockTarget();
+        try {
+            EventHandler.create(null, target, "text", "source.label");
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * the target object is null
+     */
+    public void testCreateClassObjectStringString_TargetNull() {
+        try {
+            EventHandler.create(PropertyChangeListener.class, null, "text",
+                    "source.label");
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * the action is null
+     */
+    public void testCreateClassObjectStringString_ActionNull() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, null, "source.label");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * action is invalid
+     */
+    public void testCreateClassObjectStringString_ActionInvalid() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "action_invalid",
+                "source.label");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * propertyname is null
+     */
+    public void testCreateClassObjectStringString_PropertyNameNull() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text", null);
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (Exception e) {}
+    }
+
+    /*
+     * property name is invalid
+     */
+    public void testCreateClassObjectStringString_PropertyNameInvalid() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text",
+                "source.label_invalid");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * Class under test for Object create(Class, Object, String, String, String)
+     */
+    public void testCreateClassObjectStringStringString() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text", "source.label",
+                "propertyChange");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        button.setLabel(newLabel);
+        assertEquals(MockButton.defaultName, target.getText());
+        button.setLabel("New Value: set text2.");
+        assertEquals(newLabel, target.getText());
+    }
+
+    /*
+     * listenerInterface is null
+     */
+    public void testCreateClassObjectStringStringString_ClassNull() {
+        MockTarget target = new MockTarget();
+        try {
+            EventHandler.create(null, target, "text", "source.label",
+                    "propertyChange");
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {
+
+        }
+    }
+
+    /*
+     * listenerInterface is invalid
+     */
+    public void testCreateClassObjectStringStringString_ClassInvalid() {
+        MockTarget target = new MockTarget();
+        try {
+            EventHandler.create(Serializable.class, target, "text",
+                    "source.label", "propertyChange");
+            fail("Should throw ClassCastException.");
+        } catch (ClassCastException e) {}
+    }
+
+    /*
+     * the target object is null
+     */
+    public void testCreateClassObjectStringStringString_TargetNull() {
+        try {
+            EventHandler.create(PropertyChangeListener.class, null, "text",
+                    "source.label", "propertyChange");
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * action is null
+     */
+    public void testCreateClassObjectStringStringString_ActionNull() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, null, "source.label",
+                "propertyChange");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * action is invalid
+     */
+    public void testCreateClassObjectStringStringString_ActionInvalid() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text_invalid",
+                "source.label", "propertyChange");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * property name is null
+     */
+    public void testCreateClassObjectStringStringString_PropertyNull() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text", null,
+                "propertyChange");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (Exception e) {}
+    }
+
+    /*
+     * property name is invalid
+     */
+    public void testCreateClassObjectStringStringString_PropertyInvalid() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text",
+                "source.label.invalid", "propertyChange");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+    }
+
+    /*
+     * listenerMethodName is null
+     */
+    public void testCreateClassObjectStringStringString_MethodNull() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text", "source.label",
+                null);
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        button.setLabel(newLabel);
+        assertEquals(MockButton.defaultName, target.getText());
+        button.setLabel("New Value: set text2.");
+        assertEquals(newLabel, target.getText());
+    }
+
+    /*
+     * listenerMethodName is invalid
+     */
+    public void testCreateClassObjectStringStringString_MethodInvalid() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "text", "source.label",
+                "propertyChange_invalid");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        button.setLabel(newLabel);
+        assertNull(target.getText());
+    }
+
+    /*
+     * public EventHandler(Object target, String action, String
+     * eventPropertyName, String listenerMethodName)
+     */
+    public void testEventHandler() {
+        MockTarget target = new MockTarget();
+        String action = "text";
+        String eventPropertyName = "source.label";
+        String listenerMethodName = "propertyChange";
+        EventHandler handler = new EventHandler(target, action,
+                eventPropertyName, listenerMethodName);
+        assertSame(target, handler.getTarget());
+        assertSame(action, handler.getAction());
+        assertSame(eventPropertyName, handler.getEventPropertyName());
+        assertSame(listenerMethodName, handler.getListenerMethodName());
+    }
+
+    /*
+     * target is null
+     */
+    public void testEventHandler_TargetNull() {
+        String action = "text";
+        String eventPropertyName = "source.label";
+        String listenerMethodName = "propertyChange";
+        EventHandler handler = new EventHandler(null, action,
+                eventPropertyName, listenerMethodName);
+        assertNull(handler.getTarget());
+        assertSame(action, handler.getAction());
+        assertSame(eventPropertyName, handler.getEventPropertyName());
+        assertSame(listenerMethodName, handler.getListenerMethodName());
+    }
+
+    /*
+     * action is null
+     */
+    public void testEventHandler_ActionNull() {
+        MockTarget target = new MockTarget();
+        String eventPropertyName = "source.label";
+        String listenerMethodName = "propertyChange";
+        EventHandler handler = new EventHandler(target, null,
+                eventPropertyName, listenerMethodName);
+        assertSame(target, handler.getTarget());
+        assertNull(handler.getAction());
+        assertSame(eventPropertyName, handler.getEventPropertyName());
+        assertSame(listenerMethodName, handler.getListenerMethodName());
+    }
+
+    /*
+     * EventProperty is null
+     */
+    public void testEventHandler_EventPropertyNull() {
+        MockTarget target = new MockTarget();
+        String action = "text";
+        String listenerMethodName = "propertyChange";
+        EventHandler handler = new EventHandler(target, action, null,
+                listenerMethodName);
+        assertSame(target, handler.getTarget());
+        assertSame(action, handler.getAction());
+        assertNull(handler.getEventPropertyName());
+        assertSame(listenerMethodName, handler.getListenerMethodName());
+    }
+
+    /*
+     * Method is null
+     */
+    public void testEventHandler_MethodNull() {
+        MockTarget target = new MockTarget();
+        String action = "text";
+        String eventPropertyName = "source.label";
+        EventHandler handler = new EventHandler(target, action,
+                eventPropertyName, null);
+        assertSame(target, handler.getTarget());
+        assertSame(action, handler.getAction());
+        assertSame(eventPropertyName, handler.getEventPropertyName());
+        assertNull(handler.getListenerMethodName());
+    }
+
+    public void testInvoke_1() throws SecurityException, NoSuchMethodException {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "setCalled");
+
+        String action = "text";
+        String eventPropertyName = "source.label";
+        EventHandler handler = new EventHandler(target, action,
+                eventPropertyName, null);
+        Method listenerMethod = PropertyChangeListener.class.getMethod(
+                "propertyChange", new Class[] { PropertyChangeEvent.class });
+        PropertyChangeEvent event = new PropertyChangeEvent(button, "label",
+                "1", "5");
+        handler.invoke(proxy, listenerMethod, new Object[] { event });
+        assertEquals(button.getLabel(), target.getText());
+        Method equalsMethod = Object.class.getMethod("equals",
+                new Class[] { Object.class });
+        assertEquals(Boolean.FALSE, handler.invoke(proxy, equalsMethod,
+                new String[] { "mock" }));
+    }
+
+    public void testIncompatibleMethod() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "Text", "source");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {
+
+        }
+    }
+
+    public void testCoverage_1() {
+        MockTarget target = new MockTarget();
+        MockButton button = new MockButton();
+        PropertyChangeListener proxy = EventHandler.create(
+                PropertyChangeListener.class, target, "Text", "");
+        assertTrue(Proxy.isProxyClass(proxy.getClass()));
+
+        button.addPropertyChangeListener(proxy);
+        String newLabel = "New Value: set text.";
+        try {
+            button.setLabel(newLabel);
+            fail("Should throw NullPointerException.");
+        } catch (NullPointerException e) {}
+
+    }
+
+    public void testInvoke_extend1() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "action1");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("action1", target.getActionRecord());
+    }
+
+    public void testInvoke_extend1_1() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "action4");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        try {
+            support.firePropertyChange(event);
+        } catch (Exception e) {
+
+        }
+        assertEquals("action4", target.getActionRecord());
+    }
+
+    public void testInvoke_extend2() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "action2");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        try {
+            support.firePropertyChange(event);
+            fail("Should throw exception");
+        } catch (Exception e) {
+            // e.printStackTrace();
+        }
+
+    }
+
+    public void testInvoke_extend2_2() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "action3");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+
+        assertEquals("action3", target.getActionRecord());
+    }
+
+    public void testInvoke_extend3() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "a", "source.a");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("boolean:true", target.getActionRecord());
+    }
+
+    public void testInvoke_extend4() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "b", "source.a");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("Boolean:true", target.getActionRecord());
+    }
+
+    public void testInvoke_extend4_BooleanObject() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "a", "source.booleanObject");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("boolean:true", target.getActionRecord());
+    }
+
+    public void testInvoke_extend5() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "int", "source.int");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("int:1", target.getActionRecord());
+    }
+
+    public void testInvoke_extend6() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "char", "source.char");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("char:a", target.getActionRecord());
+    }
+
+    public void testInvoke_extend7() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "byte", "source.byte");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("byte:10", target.getActionRecord());
+    }
+
+    public void testInvoke_extend8() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "short", "source.short");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("short:100", target.getActionRecord());
+    }
+
+    public void testInvoke_extend9() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "long", "source.long");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("long:1000", target.getActionRecord());
+    }
+
+    public void testInvoke_extend10() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "float", "source.float");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("float:2.2", target.getActionRecord());
+    }
+
+    public void testInvoke_extend11() {
+        MockFish fish = new MockFish();
+        MockFishTarget target = new MockFishTarget();
+        PropertyChangeSupport support = new PropertyChangeSupport(fish);
+        Object proxy = EventHandler.create(PropertyChangeListener.class,
+                target, "double", "source.double");
+        support.addPropertyChangeListener((PropertyChangeListener) proxy);
+        PropertyChangeEvent event = new PropertyChangeEvent(fish, "name", "1",
+                "5");
+        support.firePropertyChange(event);
+        assertEquals("double:3.3", target.getActionRecord());
+    }
 
     /**
      * @tests java.beans.EventHandler#create(java.lang.Class<T>,
@@ -1035,183 +952,237 @@
      */
     public void testEventHandlerCreate() {
         // Regression for HARMONY-429
-        ((FredListener) EventHandler.create(FredListener.class,
-                new Untitled1(), "i", "i"))
+        EventHandler.create(FredListener.class, new Untitled1(), "i", "i")
                 .fireFredEvent(new FredEvent("bean2"));
     }
 
     public interface FredListener extends EventListener {
-		public void fireFredEvent(FredEvent event);
-	}
 
-	public static class FredEvent extends EventObject {
+        public void fireFredEvent(FredEvent event);
+    }
 
-		private static final long serialVersionUID = 1L;
+    public static class FredEvent extends EventObject {
 
-		private static int i;
+        private static final long serialVersionUID = 1L;
 
-		public FredEvent(Object source) {
-			super(source);
-		}
+        private static int i;
 
-		public static int getI() {
-			return i;
-		}
+        public FredEvent(Object source) {
+            super(source);
+        }
 
-		public static void setI(int j) {
-			i = j;
-		}
-	}
+        public static int getI() {
+            return i;
+        }
 
-	public static class Untitled1 {
-		private int i;
+        public static void setI(int j) {
+            i = j;
+        }
+    }
 
-		public int getI() {
-			return i;
-		}
+    public static class Untitled1 {
 
-		public void setI(int i) {
-			// System.out.println("Untitled1 : setI()");
-			this.i = i;
-		}
-	}
+        private int i;
 
-	public static class MockFish {
-		String name;
+        public int getI() {
+            return i;
+        }
 
-		public String getName() {
-			return name;
-		}
+        public void setI(int i) {
+            // System.out.println("Untitled1 : setI()");
+            this.i = i;
+        }
+    }
 
-		public void setName(String name) {
-			this.name = name;
-		}
+    public static class MockFish {
 
-		public boolean isA() {
-			return true;
-		}
+        String name;
 
-		public Boolean isBooleanObject() {
-			return new Boolean(true);
-		}
+        public String getName() {
+            return name;
+        }
 
-		public int getInt() {
-			return 1;
-		}
+        public void setName(String name) {
+            this.name = name;
+        }
 
-		public char getChar() {
-			return 'a';
-		}
+        public boolean isA() {
+            return true;
+        }
 
-		public byte getByte() {
-			return 10;
-		}
+        public Boolean isBooleanObject() {
+            return new Boolean(true);
+        }
 
-		public short getShort() {
-			return 100;
-		}
+        public int getInt() {
+            return 1;
+        }
 
-		public long getLong() {
-			return 1000;
-		}
+        public char getChar() {
+            return 'a';
+        }
 
-		public float getFloat() {
-			return 2.2f;
-		}
+        public byte getByte() {
+            return 10;
+        }
 
-		public double getDouble() {
-			return 3.3;
-		}
-	}
+        public short getShort() {
+            return 100;
+        }
 
-	public static class MockFishTarget {
-		String actionRecord;
+        public long getLong() {
+            return 1000;
+        }
 
-		public void action1() {
-			this.actionRecord = "action1";
-		}
+        public float getFloat() {
+            return 2.2f;
+        }
 
-		public void setAction2(String value) {
-			this.actionRecord = "action2";
-		}
+        public double getDouble() {
+            return 3.3;
+        }
+    }
 
-		public void setAction3() {
-			this.actionRecord = "action3";
-		}
+    public static class MockFishTarget {
 
-		public void action4() {
-			this.actionRecord = "action4";
-		}
+        String actionRecord;
 
-		public void action4(EventObject event) {
-			this.actionRecord = "action4";
-		}
+        public void action1() {
+            this.actionRecord = "action1";
+        }
 
-		public String getActionRecord() {
-			return actionRecord;
-		}
+        public void setAction2(String value) {
+            this.actionRecord = "action2";
+        }
 
-		public void setA(boolean value) {
-			this.actionRecord = "boolean:" + Boolean.valueOf(value).toString();
-		}
+        public void setAction3() {
+            this.actionRecord = "action3";
+        }
 
-		public void setB(Boolean value) {
-			this.actionRecord = "Boolean:" + value.toString();
-		}
+        public void action4() {
+            this.actionRecord = "action4";
+        }
 
-		public void setInt(int value) {
-			this.actionRecord = "int:" + value;
-		}
+        public void action4(EventObject event) {
+            this.actionRecord = "action4";
+        }
 
-		public void setChar(char value) {
-			this.actionRecord = "char:" + value;
-		}
+        public String getActionRecord() {
+            return actionRecord;
+        }
 
-		public void setShort(short value) {
-			this.actionRecord = "short:" + value;
-		}
+        public void setA(boolean value) {
+            this.actionRecord = "boolean:" + Boolean.valueOf(value).toString();
+        }
 
-		public void setByte(byte value) {
-			this.actionRecord = "byte:" + value;
-		}
+        public void setB(Boolean value) {
+            this.actionRecord = "Boolean:" + value.toString();
+        }
 
-		public void setLong(long value) {
-			this.actionRecord = "long:" + value;
-		}
+        public void setInt(int value) {
+            this.actionRecord = "int:" + value;
+        }
 
-		public void setFloat(float value) {
-			this.actionRecord = "float:" + value;
-		}
+        public void setChar(char value) {
+            this.actionRecord = "char:" + value;
+        }
 
-		public void setDouble(double value) {
-			this.actionRecord = "double:" + value;
-		}
+        public void setShort(short value) {
+            this.actionRecord = "short:" + value;
+        }
 
-	}
+        public void setByte(byte value) {
+            this.actionRecord = "byte:" + value;
+        }
 
-	public static class MockTarget {
-		private boolean called;
+        public void setLong(long value) {
+            this.actionRecord = "long:" + value;
+        }
 
-		private String text;
+        public void setFloat(float value) {
+            this.actionRecord = "float:" + value;
+        }
 
-		public MockTarget() {
-			this.called = false;
-		}
+        public void setDouble(double value) {
+            this.actionRecord = "double:" + value;
+        }
 
-		public void setCalled() {
-			this.called = true;
-		}
+    }
+
+    public static class MockTarget {
+
+        private boolean called;
+
+        private String text;
+
+        public MockTarget() {
+            this.called = false;
+        }
+
+        public void setCalled() {
+            this.called = true;
+        }
+
+        public boolean isCalled() {
+            return this.called;
+        }
+
+        public void setText(String text) {
+            this.text = text;
+        }
+
+        public String getText() {
+            return this.text;
+        }
+    }
+
+    public class InvocationObject {
+
+        private String text;
+
+        private int intValue = -1;
 
-		public boolean isCalled() {
-			return this.called;
-		}
+        public InvocationObject() {}
 
-		public void setText(String text) {
-			this.text = text;
-		}
+        public void doSomething() {
+            logMethodCall(this, "doSomething", new Object[] {});
+        }
+
+        public void doSomething(int intValue) {
+            this.intValue = intValue;
+
+            logMethodCall(this, "doSomething", new Object[] { new Integer(
+                    intValue) });
+        }
+
+        public void setSomeObject(Object object) {
+            logMethodCall(this, "setSomeObject", new Object[] { object });
+        }
+
+        public void setSomeText(String text) {
+            this.text = text;
+
+            logMethodCall(this, "setSomeText", new Object[] { text });
+        }
 
-		public String getText() {
-			return this.text;
-		}
-	}
+        public String getSomeText() {
+            return text;
+        }
+
+        public int getIntValue() {
+            return intValue;
+        }
+
+        public void setIntValue(int intValue) {
+            this.intValue = intValue;
+
+            logMethodCall(this, "setIntValue", new Object[] { new Integer(
+                    intValue) });
+        }
+
+        public void setSomeValue(int i) {
+            logMethodCall(this, "setSomeValue", new Object[] { new Integer(
+                    intValue) });
+        }
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java?rev=417685&r1=417684&r2=417685&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java Wed Jun 28 00:22:12 2006
@@ -23,9 +23,11 @@
 import java.lang.reflect.Method;
 
 import junit.framework.TestCase;
-import org.apache.harmony.beans.tests.java.beans.mock.MockFakeListener;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.OtherBean;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.SampleListener;
+import org.apache.harmony.beans.tests.support.OtherBean;
+import org.apache.harmony.beans.tests.support.SampleListener;
+import org.apache.harmony.beans.tests.support.mock.MockFakeListener;
+import org.apache.harmony.beans.tests.support.mock.MockPropertyChangeEvent;
+import org.apache.harmony.beans.tests.support.mock.MockPropertyChangeListener;
 
 
 /**
@@ -88,13 +90,11 @@
 		String listenerMethodName = eventSetName;
 		Class sourceClass = MockSourceClass.class;
 		Class listenerType = MockPropertyChangeListener.class;
-		EventSetDescriptor esd = null;
 		try {
-			esd = new EventSetDescriptor(sourceClass, "FFF", listenerType,
+			new EventSetDescriptor(sourceClass, "FFF", listenerType,
 					listenerMethodName);
 			fail("Should throw IntrospectionException.");
 		} catch (IntrospectionException e) {
-
 		}
 	}
 
@@ -108,7 +108,7 @@
 		Class sourceClass = null;
 		Class listenerType = MockPropertyChangeListener.class;
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodName);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
@@ -125,7 +125,7 @@
 		Class sourceClass = MockSourceClass.class;
 		Class listenerType = MockPropertyChangeListener.class;
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass, null,
+			new EventSetDescriptor(sourceClass, null,
 					listenerType, listenerMethodName);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
@@ -142,7 +142,7 @@
 		Class sourceClass = MockSourceClass.class;
 		Class listenerType = MockPropertyChangeListener.class;
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass, "",
+			new EventSetDescriptor(sourceClass, "",
 					listenerType, listenerMethodName);
 			fail("Should throw StringIndexOutOfBoundsException.");
 		} catch (StringIndexOutOfBoundsException e) {
@@ -169,7 +169,7 @@
 		String eventSetName = "mockPropertyChange";
 		String listenerMethodName = eventSetName;
 		Class sourceClass = MockSourceClass.class;
-		Class listenerType = org.apache.harmony.beans.tests.java.beans.mock.MockPropertyChangeListener2.class;
+		Class listenerType = org.apache.harmony.beans.tests.support.mock.MockPropertyChangeListener2.class;
 		EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
 				eventSetName, listenerType, listenerMethodName);
 
@@ -203,7 +203,7 @@
 		Class sourceClass = MockSourceClass.class;
 		Class listenerType = null;
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodName);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
@@ -252,7 +252,7 @@
 		Class sourceClass = MockSourceClass.class;
 		Class listenerType = MockPropertyChangeListener.class;
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodName);
 			fail("Should throw NullPointerException.");
 		} catch (NullPointerException e) {
@@ -269,7 +269,7 @@
 		Class sourceClass = MockSourceClass.class;
 		Class listenerType = MockPropertyChangeListener.class;
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodName);
 			fail("Should throw IntrospectionException.");
 		} catch (IntrospectionException e) {
@@ -327,7 +327,7 @@
 		String removeMethod = "removeMockPropertyChangeListener";
 
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodNames, addMethod,
 					removeMethod);
 			fail("Should throw NullPointerException.");
@@ -422,7 +422,7 @@
 		String addMethod = "addMockPropertyChangeListener";
 		String removeMethod = "removeMockPropertyChangeListener";
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodNames, addMethod,
 					removeMethod);
 			fail("Should throw NullPointerException.");
@@ -443,7 +443,7 @@
 		String addMethod = "addMockPropertyChangeListener";
 		String removeMethod = "removeMockPropertyChangeListener";
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodNames, addMethod,
 					removeMethod);
 			fail("Should throw NullPointerException.");
@@ -464,7 +464,7 @@
 		String addMethod = "addMockPropertyChangeListener";
 		String removeMethod = "removeMockPropertyChangeListener";
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodNames, addMethod,
 					removeMethod);
 			fail("Should throw IntrospectionException.");
@@ -517,7 +517,7 @@
 		String addMethod = "addMockPropertyChangeListener_Invalid";
 		String removeMethod = "removeMockPropertyChangeListener";
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodNames, addMethod,
 					removeMethod);
 			fail("Should throw IntrospectionException.");
@@ -556,7 +556,7 @@
 		String addMethod = "removeMockPropertyChangeListener";
 		String removeMethod = "addMockPropertyChangeListener_Invalid";
 		try {
-			EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
+			new EventSetDescriptor(sourceClass,
 					eventSetName, listenerType, listenerMethodNames, addMethod,
 					removeMethod);
 			fail("Should throw IntrospectionException.");
@@ -802,11 +802,6 @@
 			throws IntrospectionException, NoSuchMethodException {
 		String eventSetName = "MockPropertyChange";
 		Class listenerType = MockPropertyChangeListener.class;
-		Method[] listenerMethods = new Method[] {
-				listenerType.getMethod("mockPropertyChange",
-						new Class[] { MockPropertyChangeEvent.class }),
-				listenerType.getMethod("mockPropertyChange2",
-						new Class[] { MockPropertyChangeEvent.class }), };
 		Class sourceClass = MockSourceClass.class;
 		Method addMethod = sourceClass.getMethod(
 				"addMockPropertyChangeListener", new Class[] { listenerType });
@@ -864,8 +859,6 @@
 				listenerType.getMethod("mockPropertyChange2",
 						new Class[] { MockPropertyChangeEvent.class }), };
 		Class sourceClass = MockSourceClass.class;
-		Method addMethod = sourceClass.getMethod(
-				"addMockPropertyChangeListener", new Class[] { listenerType });
 		Method removeMethod = sourceClass.getMethod(
 				"removeMockPropertyChangeListener",
 				new Class[] { listenerType });
@@ -910,12 +903,7 @@
 						new Class[] { MockPropertyChangeEvent.class }),
 				listenerType.getMethod("mockPropertyChange2",
 						new Class[] { MockPropertyChangeEvent.class }), };
-		Class sourceClass = MockSourceClass.class;
-		Method addMethod = sourceClass.getMethod(
-				"addMockPropertyChangeListener", new Class[] { listenerType });
-		Method removeMethod = sourceClass.getMethod(
-				"removeMockPropertyChangeListener",
-				new Class[] { listenerType });
+
 		EventSetDescriptor esd = new EventSetDescriptor(eventSetName,
 				listenerType, listenerMethods, null, null);
 		assertNull(esd.getRemoveListenerMethod());
@@ -991,8 +979,6 @@
 		Method removeMethod = sourceClass.getMethod(
 				"removeMockPropertyChangeListener",
 				new Class[] { listenerType });
-		Method getMethod = sourceClass.getMethod(
-				"getMockPropertyChangeListener", new Class[] { listenerType });
 
 		EventSetDescriptor esd = new EventSetDescriptor(eventSetName,
 				listenerType, listenerMethods, addMethod, removeMethod, null);
@@ -1078,14 +1064,7 @@
 			throws IntrospectionException, NoSuchMethodException {
 		String eventSetName = "MockPropertyChange";
 		Class listenerType = MockPropertyChangeListener.class;
-		Method[] listenerMethods = {
-				listenerType.getMethod("mockPropertyChange",
-						new Class[] { MockPropertyChangeEvent.class }),
-				listenerType.getMethod("mockPropertyChange2",
-						new Class[] { MockPropertyChangeEvent.class }), };
-		MethodDescriptor[] listenerMethodDescriptors = {
-				new MethodDescriptor(listenerMethods[0]),
-				new MethodDescriptor(listenerMethods[1]), };
+
 		Class sourceClass = MockSourceClass.class;
 		Method addMethod = sourceClass.getMethod(
 				"addMockPropertyChangeListener", new Class[] { listenerType });
@@ -1282,11 +1261,11 @@
 		}
 
 		public void addMockPropertyChangeListener2(
-				org.apache.harmony.beans.tests.java.beans.mock.MockPropertyChangeListener2 listener) {
+				org.apache.harmony.beans.tests.support.mock.MockPropertyChangeListener2 listener) {
 		}
 
 		public void removeMockPropertyChangeListener2(
-				org.apache.harmony.beans.tests.java.beans.mock.MockPropertyChangeListener2 listener) {
+				org.apache.harmony.beans.tests.support.mock.MockPropertyChangeListener2 listener) {
 		}
 
 		public void addMockFakeListener(MockFakeListener listener) {



Mime
View raw message