harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r412641 [22/32] - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/ main/java/java/beans/beancontext/ test/java-internal/java/beans/beancontext/ test/java/org/apache/harmony/beans/tests/ test/java/org/ap...
Date Thu, 08 Jun 2006 03:40:30 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java?rev=412641&r1=412640&r2=412641&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/VetoableChangeSupportTest.java Wed Jun  7 20:40:24 2006
@@ -1,1894 +1,1894 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.EventHandler;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyVetoException;
-import java.beans.VetoableChangeListener;
-import java.beans.VetoableChangeListenerProxy;
-import java.beans.VetoableChangeSupport;
-
-import java.beans.beancontext.BeanContextChildSupport;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import junit.framework.TestCase;
-import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockVetoableChangeListener;
-import org.apache.harmony.beans.tests.java.beans.mock.NonSerializedVCListener;
-import org.apache.harmony.beans.tests.java.beans.mock.SerializedVCListener;
-import tests.util.SerializationTester;
-
-/**
- * Unit test for VetoableChangeSupport
- */
-public class VetoableChangeSupportTest extends TestCase {
-
-	/*
-	 * Constructor a VetoableChangeSupport instance with normal input
-	 */
-	public void testVetoableChangeSupport() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-	}
-
-	/*
-	 * Class under test for void addVetoableChangeListener(String,
-	 * VetoableChangeListener)
-	 */
-	public void testAddVetoableChangeListenerStringVetoableChangeListener() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertFalse(support.hasListeners("text"));
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners(propertyName);
-		VetoableChangeListener[] listeners3 = support
-				.getVetoableChangeListeners("text");
-
-		assertEquals(0, listeners3.length);
-		assertEquals(1, listeners1.length);
-		assertEquals(1, listeners2.length);
-
-		assertSame(proxy, listeners2[0]);
-		VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[0];
-		assertSame(proxy, wrappers.getListener());
-		assertEquals(propertyName, wrappers.getPropertyName());
-
-	}
-
-	/*
-	 * add a null listener
-	 */
-	public void testAddVetoableChangeListenerStringVetoableChangeListener_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, null);
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners(propertyName);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertFalse(support.hasListeners("text"));
-
-		assertEquals(1, listeners1.length);
-		assertEquals(propertyName,
-				((VetoableChangeListenerProxy) listeners1[0]).getPropertyName());
-		assertNull(((VetoableChangeListenerProxy) listeners1[0]).getListener());
-		assertEquals(1, listeners2.length);
-		assertNull(listeners2[0]);
-	}
-
-	/*
-	 * add a listener which has already been added.
-	 */
-	public void testAddVetoableChangeListenerStringVetoableChangeListener_duplicate() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		{
-			assertTrue(support.hasListeners(propertyName));
-			assertFalse(support.hasListeners("text"));
-
-			VetoableChangeListener[] listeners1 = support
-					.getVetoableChangeListeners();
-			VetoableChangeListener[] listeners2 = support
-					.getVetoableChangeListeners(propertyName);
-			VetoableChangeListener[] listeners3 = support
-					.getVetoableChangeListeners("text");
-
-			assertEquals(0, listeners3.length);
-			assertEquals(1, listeners1.length);
-			assertEquals(1, listeners2.length);
-
-			assertSame(proxy, listeners2[0]);
-			VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[0];
-			assertSame(proxy, wrappers.getListener());
-			assertEquals(propertyName, wrappers.getPropertyName());
-		}
-
-		support.addVetoableChangeListener(propertyName, proxy);
-		{
-			assertTrue(support.hasListeners(propertyName));
-			assertFalse(support.hasListeners("text"));
-
-			VetoableChangeListener[] listeners1 = support
-					.getVetoableChangeListeners();
-			VetoableChangeListener[] listeners2 = support
-					.getVetoableChangeListeners(propertyName);
-			VetoableChangeListener[] listeners3 = support
-					.getVetoableChangeListeners("text");
-
-			assertEquals(0, listeners3.length);
-			assertEquals(2, listeners1.length);
-			assertEquals(2, listeners2.length);
-			for (int i = 0; i < listeners2.length; i++) {
-				assertSame(proxy, listeners2[i]);
-				VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[i];
-				assertSame(proxy, wrappers.getListener());
-				assertEquals(propertyName, wrappers.getPropertyName());
-			}
-		}
-	}
-
-	/*
-	 * add listener with null property name.
-	 */
-	public void testAddVetoableChangeListenerStringVetoableChangeListener_property_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		String propertyName = null;
-		try {
-			support.addVetoableChangeListener(propertyName, proxy);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/*
-	 * add listeners to an invalid property
-	 */
-	public void testAddVetoableChangeListenerStringVetoableChangeListener_property_invalid() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		String propertyName = "label_invalid";
-		support.addVetoableChangeListener(propertyName, proxy);
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners("label_invalid");
-		assertEquals(1, listeners1.length);
-		assertEquals(1, listeners2.length);
-		assertEquals("label_invalid",
-				((VetoableChangeListenerProxy) listeners1[0]).getPropertyName());
-		assertSame(proxy, listeners2[0]);
-		assertFalse(support.hasListeners("label"));
-	}
-
-	/*
-	 * add different listener with a particular property name.
-	 */
-	public void testAddVetoableChangeListenerStringVetoableChangeListener_property_duplicate() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		support.addVetoableChangeListener(propertyName, proxy2);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertFalse(support.hasListeners("text"));
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners(propertyName);
-		VetoableChangeListener[] listeners3 = support
-				.getVetoableChangeListeners("text");
-
-		assertEquals(0, listeners3.length);
-		assertEquals(2, listeners1.length);
-		assertEquals(2, listeners2.length);
-		for (int i = 0; i < listeners2.length; i++) {
-			assertTrue((proxy == listeners2[i]) || (proxy2 == listeners2[i]));
-			VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[i];
-			assertTrue((proxy == wrappers.getListener())
-					|| (proxy2 == wrappers.getListener()));
-			assertEquals(propertyName, wrappers.getPropertyName());
-		}
-	}
-
-	/*
-	 * Class under test for void
-	 * addVetoableChangeListener(VetoableChangeListener)
-	 */
-	public void testAddVetoableChangeListenerVetoableChangeListener() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners("label"));
-		assertTrue(support.hasListeners("text"));
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners("label");
-		VetoableChangeListener[] listeners3 = support
-				.getVetoableChangeListeners("text");
-
-		assertEquals(1, listeners1.length);
-		assertEquals(0, listeners2.length);
-		assertEquals(0, listeners3.length);
-
-		assertSame(proxy, listeners1[0]);
-	}
-
-	/*
-	 * add a null listener
-	 */
-	public void testAddVetoableChangeListenerVetoableChangeListener_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-		support.addVetoableChangeListener(null);
-
-		assertTrue(support.hasListeners("label"));
-		assertTrue(support.hasListeners("text"));
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners("label");
-		VetoableChangeListener[] listeners3 = support
-				.getVetoableChangeListeners("text");
-
-		assertEquals(1, listeners1.length);
-		assertEquals(0, listeners2.length);
-		assertEquals(0, listeners3.length);
-
-		assertNull(listeners1[0]);
-	}
-
-	/*
-	 * add duplicated listeners
-	 */
-	public void testAddVetoableChangeListenerVetoableChangeListener_duplicate() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners("label"));
-		assertTrue(support.hasListeners("text"));
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners("label");
-		VetoableChangeListener[] listeners3 = support
-				.getVetoableChangeListeners("text");
-
-		assertEquals(2, listeners1.length);
-		assertEquals(0, listeners2.length);
-		assertEquals(0, listeners3.length);
-		for (int i = 0; i < listeners1.length; i++) {
-			assertSame(proxy, listeners1[i]);
-		}
-	}
-
-	/*
-	 * add two different listeners
-	 */
-	public void testAddVetoableChangeListenerVetoableChangeListener_TwoDifferent() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "getText");
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy2);
-
-		assertTrue(support.hasListeners("label"));
-		assertTrue(support.hasListeners("text"));
-
-		VetoableChangeListener[] listeners1 = support
-				.getVetoableChangeListeners();
-		VetoableChangeListener[] listeners2 = support
-				.getVetoableChangeListeners("label");
-		VetoableChangeListener[] listeners3 = support
-				.getVetoableChangeListeners("text");
-
-		assertEquals(2, listeners1.length);
-		assertEquals(0, listeners2.length);
-		assertEquals(0, listeners3.length);
-		for (int i = 0; i < listeners1.length; i++) {
-			assertTrue((proxy == listeners1[i]) || (proxy2 == listeners1[i]));
-		}
-	}
-
-	/*
-	 * add a VetoableChangeListenerProxy
-	 */
-	public void testAddVetoableChangeListenerVetoableChangeListener_Proxy() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		proxy = new MockVetoableChangeListener();
-		String propertyName = "label";
-
-		VetoableChangeListenerProxy listenerProxy = new VetoableChangeListenerProxy(
-				propertyName, proxy);
-
-		support.addVetoableChangeListener(listenerProxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertFalse(support.hasListeners("text"));
-		{
-			VetoableChangeListener[] listeners1 = support
-					.getVetoableChangeListeners();
-			VetoableChangeListener[] listeners2 = support
-					.getVetoableChangeListeners(propertyName);
-			VetoableChangeListener[] listeners3 = support
-					.getVetoableChangeListeners("text");
-
-			assertEquals(0, listeners3.length);
-			assertEquals(1, listeners1.length);
-			assertEquals(1, listeners2.length);
-
-			assertSame(proxy, listeners2[0]);
-			VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[0];
-			assertSame(proxy, wrappers.getListener());
-			assertEquals(propertyName, wrappers.getPropertyName());
-		}
-		// add test for remove proxy
-		support.removeVetoableChangeListener(listenerProxy);
-		{
-			VetoableChangeListener[] listeners1 = support
-					.getVetoableChangeListeners();
-			VetoableChangeListener[] listeners2 = support
-					.getVetoableChangeListeners(propertyName);
-			assertEquals(0, listeners1.length);
-			assertEquals(0, listeners2.length);
-		}
-
-	}
-
-	/*
-	 * Class under test for void fireVetoableChange(PropertyChangeEvent)
-	 */
-	public void testFireVetoableChangePropertyChangeEvent()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
-				"Label: old", "Label: new");
-		support.fireVetoableChange(event);
-
-		assertEquals("called", source.getText());
-	}
-
-	public void testFireVetoableChangePropertyChangeEvent_Veto()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		MockVetoListener normal1 = new MockVetoListener(false, "Norm1");
-		support.addVetoableChangeListener(normal1);
-
-		MockVetoListener veto1 = new MockVetoListener(true, "Veto1");
-		support.addVetoableChangeListener(veto1);
-
-		MockVetoListener normal2 = new MockVetoListener(false, "Norm2");
-		support.addVetoableChangeListener(normal2);
-
-		MockVetoListener veto2 = new MockVetoListener(true, "Veto2");
-		support.addVetoableChangeListener(veto2);
-
-		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
-				"1", "5");
-		try {
-			support.fireVetoableChange(event);
-		} catch (PropertyVetoException e) {
-
-		}
-
-		assertEquals(4, support.getVetoableChangeListeners().length);
-
-		// Check the calling status of the first listener
-		{
-			ArrayList oldValues = normal1.getOldValues();
-			assertEquals(2, oldValues.size());
-			assertEquals("1", oldValues.get(0));
-			assertEquals("5", oldValues.get(1));
-
-			ArrayList newValues = normal1.getNewValues();
-			assertEquals(2, newValues.size());
-			assertEquals("5", newValues.get(0));
-			assertEquals("1", newValues.get(1));
-		}
-
-		// Check the status of the second (Veto) listeners
-		{
-			ArrayList oldValues = veto1.getOldValues();
-			assertEquals(2, oldValues.size());
-			assertEquals("1", oldValues.get(0));
-			assertEquals("5", oldValues.get(1));
-
-			ArrayList newValues = veto1.getNewValues();
-			assertEquals(2, newValues.size());
-			assertEquals("5", newValues.get(0));
-			assertEquals("1", newValues.get(1));
-		}
-
-		// Check the status of the third listeners
-		{
-			ArrayList oldValues = normal2.getOldValues();
-			assertEquals(1, oldValues.size());
-			assertEquals("5", oldValues.get(0));
-
-			ArrayList newValues = normal2.getNewValues();
-			assertEquals(1, newValues.size());
-			assertEquals("1", newValues.get(0));
-		}
-
-		// Check the status of the fourth (Veto) listeners
-		{
-			ArrayList oldValues = veto2.getOldValues();
-			assertEquals(1, oldValues.size());
-			assertEquals("5", oldValues.get(0));
-
-			ArrayList newValues = veto2.getNewValues();
-			assertEquals(1, newValues.size());
-			assertEquals("1", newValues.get(0));
-		}
-	}
-
-	/*
-	 * fire a null event
-	 */
-	public void testFireVetoableChangePropertyChangeEvent_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		try {
-			support.fireVetoableChange(null);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * register for one property
-	 */
-	public void testFireVetoableChangePropertyChangeEvent_property()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
-				"Label: old", "Label: new");
-		support.fireVetoableChange(event);
-
-		assertEquals("called", source.getText());
-	}
-
-	public void testFireVetoableChangePropertyChangeEvent_property_invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label_invalid";
-		support.addVetoableChangeListener(propertyName, proxy);
-		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
-				"Label: old", "Label: new");
-		support.fireVetoableChange(event);
-
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * there are two same listeners, and another different listener.
-	 */
-	public void testFireVetoableChangePropertyChangeEvent_DuplicateListener()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "increaseTop");
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy2);
-
-		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
-				"Label: old", "Label: new");
-		support.fireVetoableChange(event);
-		assertEquals(2, source.getTop());
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * listener is null
-	 */
-	public void testFireVetoableChangePropertyChangeEvent_listener_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		support.addVetoableChangeListener(null);
-		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
-				"Label: old", "Label: new");
-		try {
-			support.fireVetoableChange(event);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * Class under test for void fireVetoableChange(String, boolean, boolean)
-	 */
-	public void testFireVetoableChangeStringbooleanboolean()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", true, false);
-
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * register a null listener
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_listener_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		support.addVetoableChangeListener(null);
-		try {
-			support.fireVetoableChange("label", true, false);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * register listener for property "label".
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_property()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label", true, false);
-
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * register a null listener
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_listener_null_property()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", null);
-		try {
-			support.fireVetoableChange("label", true, false);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * two different listeners registered for all
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_twoListeners()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "increaseTop");
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy2);
-
-		support.fireVetoableChange("label", true, false);
-
-		assertEquals("called", source.getText());
-		assertEquals(1, source.getTop());
-	}
-
-	/*
-	 * two different listeners registered for property "label"
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_property_twoListeners()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "increaseTop");
-		support.addVetoableChangeListener("label", proxy);
-		support.addVetoableChangeListener("label", proxy2);
-
-		support.fireVetoableChange("label", true, false);
-
-		assertEquals("called", source.getText());
-		assertEquals(1, source.getTop());
-	}
-
-	/*
-	 * null propertyname
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_Property_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "label",
-						"source.text");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange(null, true, false);
-		assertEquals(source.getText(), source.getLabel());
-	}
-
-	/*
-	 * register listener to label.
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_listener_Property_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "label",
-						"source.text");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange(null, true, false);
-		assertEquals("label.default", source.getLabel());
-	}
-
-	/*
-	 * register a null listener
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_listener_Null_Property_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "label",
-						"source.text");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange(null, true, false);
-		assertEquals("label.default", source.getLabel());
-	}
-
-	/*
-	 * invalid propertyname
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_Property_invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "label",
-						"source.text");
-		support.addVetoableChangeListener(proxy);
-		String newText = "new Text value";
-		source.setText(newText);
-
-		support.fireVetoableChange("label_invalid", true, false);
-		assertEquals(newText, source.getLabel());
-	}
-
-	/*
-	 * register listener for lablel property
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_listener_Property_invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "label",
-						"source.text");
-		support.addVetoableChangeListener("label", proxy);
-		String newText = "new Text value";
-		source.setText(newText);
-
-		support.fireVetoableChange("text", true, false);
-		assertEquals("label.default", source.getLabel());
-
-		support.fireVetoableChange("label_invalid", true, false);
-		assertEquals("label.default", source.getLabel());
-
-		support.fireVetoableChange("label", true, false);
-		assertEquals(newText, source.getLabel());
-	}
-
-	/*
-	 * oldvalue==newValue
-	 */
-	public void testFireVetoableChangeStringbooleanboolean_SameValue()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-
-		support.fireVetoableChange("label", true, true);
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * Class under test for void fireVetoableChange(String, int, int)
-	 * 
-	 * register listener for all
-	 */
-	public void testFireVetoableChangeStringintint()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", 1, 2);
-
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * Propertyname is null register listener for all
-	 */
-	public void testFireVetoableChangeStringintint_property_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange(null, 1, 2);
-
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * property name is invalid register listener for all
-	 */
-	public void testFireVetoableChangeStringintint_property_Invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label_invalide", 1, 2);
-
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * oldvalue=newVlaue register listener for all
-	 */
-	public void testFireVetoableChangeStringintint_SameValue()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", 1, 1);
-
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * Class under test for void fireVetoableChange(String, int, int)
-	 * 
-	 * register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringintint_listener()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label", 1, 2);
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * Propertyname is null register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringintint_listener_property_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange(null, 1, 2);
-
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * property name is invalid register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringintint_listener_property_Invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label_invalide", 1, 2);
-
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * oldvalue=newVlaue register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringintint_listener_SameValue()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label", 1, 1);
-
-		assertEquals("text.default", source.getText());
-	}
-
-	public void testFireVetoableChangeStringintint_listener_Invalid_property()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label_invalid", proxy);
-		support.fireVetoableChange("label", 1, 2);
-
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * Class under test for void fireVetoableChange(String, Object, Object)
-	 * 
-	 * register listener for all
-	 */
-	public void testFireVetoableChangeStringObjectObject()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", "Label: old", "Label: new");
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * property name is null. register listener for all
-	 */
-	public void testFireVetoableChangeStringObjectObject_property_Null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange(null, "Label: old", "Label: new");
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * property name is invalid. register listener for all
-	 */
-	public void testFireVetoableChangeStringObjectObject_property_invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label_invalid", "Label: old", "Label: new");
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * oldValue=NewValue. register listener for all
-	 */
-	public void testFireVetoableChangeStringObjectObject_SameValue()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", "Label: old", "Label: old");
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * oldValue=NewValue=null. register listener for all
-	 */
-	public void testFireVetoableChangeStringObjectObject_SameValue_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", null, null);
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * Class under test for void fireVetoableChange(String, Object, Object)
-	 * 
-	 * register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringObjectObject_listener()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label", "Label: old", "Label: new");
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * property name is null. register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringObjectObject_listener_property_Null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange(null, "Label: old", "Label: new");
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * property name is invalid. register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringObjectObject_listener_property_invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label_invalid", "Label: old", "Label: new");
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * oldValue=NewValue. register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringObjectObject_listener_SameValue()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener(proxy);
-		support.fireVetoableChange("label", "Label: old", "Label: old");
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * oldValue=NewValue=null. register listener for one property - "label"
-	 */
-	public void testFireVetoableChangeStringObjectObject_listener_SameValue_null()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label", proxy);
-		support.fireVetoableChange("label", null, null);
-		assertEquals("called", source.getText());
-	}
-
-	/*
-	 * register listener to an invalid property
-	 */
-	public void testFireVetoableChangeStringObjectObject_listener_invalid()
-			throws PropertyVetoException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		support.addVetoableChangeListener("label_invalid", proxy);
-		support.fireVetoableChange("label", "1", "2");
-		assertEquals("text.default", source.getText());
-	}
-
-	/*
-	 * Class under test for void removeVetoableChangeListener(String,
-	 * VetoableChangeListener)
-	 * 
-	 * register listener for property
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_property() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-
-		support.removeVetoableChangeListener(propertyName, proxy);
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(0, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * register listener for property, two same listeners
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_property_more() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		support.addVetoableChangeListener(propertyName, proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(2, support.getVetoableChangeListeners(propertyName).length);
-
-		support.removeVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * register listener for property, two different listeners
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_property_diff() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "getText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		support.addVetoableChangeListener(propertyName, proxy2);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(2, support.getVetoableChangeListeners(propertyName).length);
-
-		support.removeVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-		assertSame(proxy2, support.getVetoableChangeListeners(propertyName)[0]);
-	}
-
-	/*
-	 * register listener for property, two different listeners
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_listener_diff() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "getText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-
-		support.removeVetoableChangeListener(propertyName, proxy2);
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_listener_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, null);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-
-		support.removeVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-		assertNull(support.getVetoableChangeListeners(propertyName)[0]);
-	}
-
-	/*
-	 * register listener for property.
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_all() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(proxy);
-		assertTrue(support.hasListeners(propertyName));
-
-		support.removeVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * remove listener from null property
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_propertyName_Null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-		try {
-			support.removeVetoableChangeListener(null, proxy);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * propertyname is invalid
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_propertyName_Invalid() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, proxy);
-		assertTrue(support.hasListeners(propertyName));
-
-		support.removeVetoableChangeListener(propertyName + "_invalid", proxy);
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * no listener attached to the property
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_propertyName_NoListener() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		assertFalse(support.hasListeners(propertyName));
-
-		support.removeVetoableChangeListener(propertyName, proxy);
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(0, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * listener null
-	 */
-	public void testRemoveVetoableChangeListenerStringVetoableChangeListener_listener_null_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(propertyName, null);
-		assertTrue(support.hasListeners(propertyName));
-
-		support.removeVetoableChangeListener(propertyName, null);
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(0, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * Class under test for void
-	 * removeVetoableChangeListener(VetoableChangeListener)
-	 * 
-	 * register listener for all
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_all() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(proxy);
-		assertTrue(support.hasListeners(propertyName));
-
-		support.removeVetoableChangeListener(proxy);
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(0, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * two same listeners
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_all_more() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(2, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * two different listeners
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_all_more_diff() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "getText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(proxy);
-		support.addVetoableChangeListener(proxy2);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(2, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-		assertEquals(proxy2, support.getVetoableChangeListeners()[0]);
-	}
-
-	/*
-	 * listener null
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_all_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(null);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * register for one property
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_property() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener("label", proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * listener null
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(proxy);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(null);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(1, support.getVetoableChangeListeners().length);
-	}
-
-	/*
-	 * register null listener, remove null listener.
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_null_null() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		support.addVetoableChangeListener(null);
-
-		assertTrue(support.hasListeners(propertyName));
-		assertEquals(1, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(null);
-
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(0, support.getVetoableChangeListeners().length);
-	}
-
-    /*
-     * Regression test for HARMONY-321
-     */
-    public void testFireVetoableChange_regression() {
-        VetoableChangeSupport vcs = new VetoableChangeSupport(this);
-        MockVetoListener2 vlistener = new MockVetoListener2();
-
-        vcs.addVetoableChangeListener(vlistener);
-        try {
-            vcs.fireVetoableChange(vlistener.vetoedPropName, 0, 1);
-            fail("PropertyVetoException expected");
-        } catch (PropertyVetoException ok) {}
-
-        assertEquals(1, vlistener.event.getOldValue());
-        assertEquals(0, vlistener.event.getNewValue());
-    } 
-
-    
-	/*
-	 * no this listener
-	 */
-	public void testRemoveVetoableChangeListenerVetoableChangeListener_invalid() {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
-				.create(VetoableChangeListener.class, source, "setText");
-
-		String propertyName = "label";
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners().length);
-
-		support.removeVetoableChangeListener(proxy);
-
-		assertFalse(support.hasListeners(propertyName));
-		assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
-		assertEquals(0, support.getVetoableChangeListeners().length);
-	}
-
-	public void testSerialization() throws IOException, ClassNotFoundException {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		String propertyName1 = "text";
-		SerializedVCListener serialized = new SerializedVCListener(
-				propertyName1);
-		support.addVetoableChangeListener(propertyName1, serialized);
-
-		String propertyName2 = "top";
-		NonSerializedVCListener nonSerialized = new NonSerializedVCListener(
-				propertyName2);
-		support.addVetoableChangeListener(propertyName2, nonSerialized);
-
-		assertTrue(support.hasListeners(propertyName1));
-		assertTrue(support.hasListeners(propertyName2));
-		assertEquals(2, support.getVetoableChangeListeners().length);
-		assertEquals(1,
-				support.getVetoableChangeListeners(propertyName1).length);
-		assertEquals(1,
-				support.getVetoableChangeListeners(propertyName2).length);
-
-		VetoableChangeSupport deserializedSupport = (VetoableChangeSupport) SerializationTester
-				.getDeserilizedObject(support);
-
-		assertTrue(deserializedSupport.hasListeners(propertyName1));
-		assertFalse(deserializedSupport.hasListeners(propertyName2));
-		assertEquals(1, deserializedSupport.getVetoableChangeListeners().length);
-		assertEquals(1, deserializedSupport
-				.getVetoableChangeListeners(propertyName1).length);
-		assertEquals(0, deserializedSupport
-				.getVetoableChangeListeners(propertyName2).length);
-
-		assertEquals(
-				support.getVetoableChangeListeners(propertyName1)[0],
-				deserializedSupport.getVetoableChangeListeners(propertyName1)[0]);
-
-	}
-
-	public void testSerialization_Compatibility() throws Exception {
-		MockSource source = new MockSource();
-		VetoableChangeSupport support = new VetoableChangeSupport(source);
-
-		String propertyName1 = "text";
-		SerializedVCListener serialized = new SerializedVCListener(
-				propertyName1);
-		support.addVetoableChangeListener(propertyName1, serialized);
-
-		String propertyName2 = "top";
-		NonSerializedVCListener nonSerialized = new NonSerializedVCListener(
-				propertyName2);
-		support.addVetoableChangeListener(propertyName2, nonSerialized);
-
-		assertTrue(support.hasListeners(propertyName1));
-		assertTrue(support.hasListeners(propertyName2));
-		assertEquals(2, support.getVetoableChangeListeners().length);
-		assertEquals(1,
-				support.getVetoableChangeListeners(propertyName1).length);
-		assertEquals(1,
-				support.getVetoableChangeListeners(propertyName2).length);
-
-		VetoableChangeSupport deserializedSupport = (VetoableChangeSupport) SerializationTester
-				.readObject(support,
-						"serialization/java/beans/VetoableChangeSupport.ser");
-
-		assertTrue(deserializedSupport.hasListeners(propertyName1));
-		assertFalse(deserializedSupport.hasListeners(propertyName2));
-		assertEquals(1, deserializedSupport.getVetoableChangeListeners().length);
-		assertEquals(1, deserializedSupport
-				.getVetoableChangeListeners(propertyName1).length);
-		assertEquals(0, deserializedSupport
-				.getVetoableChangeListeners(propertyName2).length);
-
-		assertEquals(
-				support.getVetoableChangeListeners(propertyName1)[0],
-				deserializedSupport.getVetoableChangeListeners(propertyName1)[0]);
-	}
-
-	public static class MockSource implements Serializable {
-		private String name;
-
-		private String text;
-
-		private String label;
-
-		private int top;
-
-		private boolean visible;
-
-		public MockSource() {
-			this.name = getClass().getName();
-			this.text = "text.default";
-			this.label = "label.default";
-		}
-
-		/**
-		 * @return Returns the name.
-		 */
-		public String getName() {
-			return name;
-		}
-
-		/**
-		 * @param name
-		 *            The name to set.
-		 */
-		public void setName(String name) {
-			this.name = name;
-		}
-
-		/**
-		 * @return Returns the text.
-		 */
-		public String getText() {
-			return text;
-		}
-
-		/**
-		 * @param text
-		 *            The text to set.
-		 */
-		public void setText(String text) {
-			this.text = text;
-		}
-
-		public void setText() {
-			this.text = "called";
-		}
-
-		/**
-		 * @return Returns the top.
-		 */
-		public int getTop() {
-			return top;
-		}
-
-		/**
-		 * @param top
-		 *            The top to set.
-		 */
-		public void setTop(int top) {
-			this.top = top;
-		}
-
-		public void increaseTop() {
-			this.top++;
-		}
-
-		/**
-		 * @return Returns the visible.
-		 */
-		public boolean isVisible() {
-			return visible;
-		}
-
-		/**
-		 * @param visible
-		 *            The visible to set.
-		 */
-		public void setVisible(boolean visible) {
-			this.visible = visible;
-		}
-
-		/**
-		 * @return Returns the label.
-		 */
-		public String getLabel() {
-			return label;
-		}
-
-		/**
-		 * @param label
-		 *            The label to set.
-		 */
-		public void setLabel(String label) {
-			this.label = label;
-		}
-	}
-
-	public static class MockVetoListener implements VetoableChangeListener {
-		ArrayList oldValues = new ArrayList();
-
-		ArrayList newValues = new ArrayList();
-
-		boolean veto;
-
-		String prefix;
-
-		public MockVetoListener(boolean veto, String prefix) {
-			this.veto = veto;
-			this.prefix = prefix;
-		}
-
-		public void vetoableChange(PropertyChangeEvent event)
-				throws PropertyVetoException {
-			oldValues.add(event.getOldValue());
-			newValues.add(event.getNewValue());
-
-			if (false) {
-				System.out.println(prefix + " old: " + event.getOldValue()
-						+ " new: " + event.getNewValue());
-			}
-			if (veto) {
-				throw new PropertyVetoException("Vete Change", event);
-			}
-		}
-
-		public ArrayList getOldValues() {
-			return this.oldValues;
-		}
-
-		public ArrayList getNewValues() {
-			return this.newValues;
-		}
-
-	}
-
-    public static class MockVetoListener2 implements VetoableChangeListener {
-
-        public PropertyChangeEvent event;
-
-        public final String vetoedPropName = "prop";
-
-        public void vetoableChange(PropertyChangeEvent e)
-                throws PropertyVetoException {
-
-            event = e;
-            String propName = e.getPropertyName();
-
-            if (propName.equals(vetoedPropName)
-                    && e.getNewValue().equals(new Integer(1))) {
-                throw new PropertyVetoException(
-                        propName + " change is vetoed!", e);
-            }
-        }
-
-    }
-
-    
-    /**
-     * @tests java.beans.VetoableChangeSupport#VetoableChangeSupport(
-     *        java.lang.Object)
-     */
-    public void testVetoableChangeSupport_null() {
-        // Regression for HARMONY-228
-        try {
-            new VetoableChangeSupport(null);
-            fail("Should throw NullPointerException.");
-        } catch (NullPointerException e) {
-        }
-    }
-
-    /**
-     * @tests java.beans.VetoableChangeSupport#addVetoableChangeListener(java.lang.String,
-     *        java.beans.VetoableChangeListener)
-     */
-    public void test_addPropertyChangeListenerNullNull() throws Exception {
-        // Regression for HARMONY-441
-        new VetoableChangeSupport("bean1")
-                .addVetoableChangeListener(null, null);
-    }
-
-    
-    public void test_readObject() throws Exception {
-        // Regression for HARMONY-421
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-        ObjectOutputStream oos = new ObjectOutputStream(baos);
-        oos.writeObject(new BeanContextChildSupport());
-        oos.flush();
-
-        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(
-                baos.toByteArray()));
-        ois.readObject();
-
-        ois.close();
-        oos.close();
-    }
-
-
-    /**
-     * The test checks the method add() with no property specified
-     */
-    public void testAddVetoableChangeListener() {
-        VetoableChangeSupport vcs = new VetoableChangeSupport("bean1");
-        VetoableChangeListener vcl = new VetoableChangeListener() {
-            public void vetoableChange(PropertyChangeEvent pce) {
-            }
-        };
-        vcs.addVetoableChangeListener(vcl);
-        VetoableChangeListener[] vcls = vcs.getVetoableChangeListeners();
-
-        assertNotNull("Returned listeners is null.", vcls);
-        assertEquals(1, vcls.length);
-        assertEquals(vcl, vcls[0]);
-    }
-    
-    /**
-     * The test checks the method add() for property specified
-     */
-    public void testAddVetoableChangeListenerByPropertyName() {
-        VetoableChangeSupport vcs = new VetoableChangeSupport("bean1");
-        VetoableChangeListener vcl = new VetoableChangeListener() {
-            public void vetoableChange(PropertyChangeEvent pce) {
-            }
-        };
-        vcs.addVetoableChangeListener("property1", vcl);
-        VetoableChangeListener[] vcls = vcs.getVetoableChangeListeners(
-                "property1");
-
-        assertNotNull("Returned listeners is null.", vcls);
-        assertEquals(1, vcls.length);
-        assertEquals(vcl, vcls[0]);
-    }
-    
-    /**
-     * The test checks the method add() for VetoableChangeListenerProxy
-     */
-    public void testAddVetoableChangeListenerProxy() {
-        VetoableChangeSupport vcs = new VetoableChangeSupport("bean1");
-        VetoableChangeListener vcl = new VetoableChangeListener() {
-            public void vetoableChange(PropertyChangeEvent pce) {}
-        };
-        vcs.addVetoableChangeListener("property1", vcl);
-        VetoableChangeListener[] vcls = vcs.getVetoableChangeListeners();
-
-        assertNotNull("Returned listeners is null.", vcls);
-        assertEquals(1, vcls.length);
-
-        assertTrue("Listener is not of VetoableChangeListenerProxy type",
-                vcls[0] instanceof VetoableChangeListenerProxy);
-        assertEquals(vcl, ((VetoableChangeListenerProxy) vcls[0]).getListener());
-        assertEquals("property1", ((VetoableChangeListenerProxy) vcls[0])
-                .getPropertyName());
-    }
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.EventHandler;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+import java.beans.VetoableChangeListenerProxy;
+import java.beans.VetoableChangeSupport;
+
+import java.beans.beancontext.BeanContextChildSupport;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import junit.framework.TestCase;
+import org.apache.harmony.beans.tests.java.beans.beancontext.mock.MockVetoableChangeListener;
+import org.apache.harmony.beans.tests.java.beans.mock.NonSerializedVCListener;
+import org.apache.harmony.beans.tests.java.beans.mock.SerializedVCListener;
+import tests.util.SerializationTester;
+
+/**
+ * Unit test for VetoableChangeSupport
+ */
+public class VetoableChangeSupportTest extends TestCase {
+
+	/*
+	 * Constructor a VetoableChangeSupport instance with normal input
+	 */
+	public void testVetoableChangeSupport() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+	}
+
+	/*
+	 * Class under test for void addVetoableChangeListener(String,
+	 * VetoableChangeListener)
+	 */
+	public void testAddVetoableChangeListenerStringVetoableChangeListener() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		String propertyName = "label";
+		support.addVetoableChangeListener(propertyName, proxy);
+
+		assertTrue(support.hasListeners(propertyName));
+		assertFalse(support.hasListeners("text"));
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners(propertyName);
+		VetoableChangeListener[] listeners3 = support
+				.getVetoableChangeListeners("text");
+
+		assertEquals(0, listeners3.length);
+		assertEquals(1, listeners1.length);
+		assertEquals(1, listeners2.length);
+
+		assertSame(proxy, listeners2[0]);
+		VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[0];
+		assertSame(proxy, wrappers.getListener());
+		assertEquals(propertyName, wrappers.getPropertyName());
+
+	}
+
+	/*
+	 * add a null listener
+	 */
+	public void testAddVetoableChangeListenerStringVetoableChangeListener_null() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		String propertyName = "label";
+		support.addVetoableChangeListener(propertyName, null);
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners(propertyName);
+
+		assertTrue(support.hasListeners(propertyName));
+		assertFalse(support.hasListeners("text"));
+
+		assertEquals(1, listeners1.length);
+		assertEquals(propertyName,
+				((VetoableChangeListenerProxy) listeners1[0]).getPropertyName());
+		assertNull(((VetoableChangeListenerProxy) listeners1[0]).getListener());
+		assertEquals(1, listeners2.length);
+		assertNull(listeners2[0]);
+	}
+
+	/*
+	 * add a listener which has already been added.
+	 */
+	public void testAddVetoableChangeListenerStringVetoableChangeListener_duplicate() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		String propertyName = "label";
+		support.addVetoableChangeListener(propertyName, proxy);
+		{
+			assertTrue(support.hasListeners(propertyName));
+			assertFalse(support.hasListeners("text"));
+
+			VetoableChangeListener[] listeners1 = support
+					.getVetoableChangeListeners();
+			VetoableChangeListener[] listeners2 = support
+					.getVetoableChangeListeners(propertyName);
+			VetoableChangeListener[] listeners3 = support
+					.getVetoableChangeListeners("text");
+
+			assertEquals(0, listeners3.length);
+			assertEquals(1, listeners1.length);
+			assertEquals(1, listeners2.length);
+
+			assertSame(proxy, listeners2[0]);
+			VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[0];
+			assertSame(proxy, wrappers.getListener());
+			assertEquals(propertyName, wrappers.getPropertyName());
+		}
+
+		support.addVetoableChangeListener(propertyName, proxy);
+		{
+			assertTrue(support.hasListeners(propertyName));
+			assertFalse(support.hasListeners("text"));
+
+			VetoableChangeListener[] listeners1 = support
+					.getVetoableChangeListeners();
+			VetoableChangeListener[] listeners2 = support
+					.getVetoableChangeListeners(propertyName);
+			VetoableChangeListener[] listeners3 = support
+					.getVetoableChangeListeners("text");
+
+			assertEquals(0, listeners3.length);
+			assertEquals(2, listeners1.length);
+			assertEquals(2, listeners2.length);
+			for (int i = 0; i < listeners2.length; i++) {
+				assertSame(proxy, listeners2[i]);
+				VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[i];
+				assertSame(proxy, wrappers.getListener());
+				assertEquals(propertyName, wrappers.getPropertyName());
+			}
+		}
+	}
+
+	/*
+	 * add listener with null property name.
+	 */
+	public void testAddVetoableChangeListenerStringVetoableChangeListener_property_null() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		String propertyName = null;
+		try {
+			support.addVetoableChangeListener(propertyName, proxy);
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+		}
+	}
+
+	/*
+	 * add listeners to an invalid property
+	 */
+	public void testAddVetoableChangeListenerStringVetoableChangeListener_property_invalid() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		String propertyName = "label_invalid";
+		support.addVetoableChangeListener(propertyName, proxy);
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners("label_invalid");
+		assertEquals(1, listeners1.length);
+		assertEquals(1, listeners2.length);
+		assertEquals("label_invalid",
+				((VetoableChangeListenerProxy) listeners1[0]).getPropertyName());
+		assertSame(proxy, listeners2[0]);
+		assertFalse(support.hasListeners("label"));
+	}
+
+	/*
+	 * add different listener with a particular property name.
+	 */
+	public void testAddVetoableChangeListenerStringVetoableChangeListener_property_duplicate() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+
+		String propertyName = "label";
+		support.addVetoableChangeListener(propertyName, proxy);
+		support.addVetoableChangeListener(propertyName, proxy2);
+
+		assertTrue(support.hasListeners(propertyName));
+		assertFalse(support.hasListeners("text"));
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners(propertyName);
+		VetoableChangeListener[] listeners3 = support
+				.getVetoableChangeListeners("text");
+
+		assertEquals(0, listeners3.length);
+		assertEquals(2, listeners1.length);
+		assertEquals(2, listeners2.length);
+		for (int i = 0; i < listeners2.length; i++) {
+			assertTrue((proxy == listeners2[i]) || (proxy2 == listeners2[i]));
+			VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[i];
+			assertTrue((proxy == wrappers.getListener())
+					|| (proxy2 == wrappers.getListener()));
+			assertEquals(propertyName, wrappers.getPropertyName());
+		}
+	}
+
+	/*
+	 * Class under test for void
+	 * addVetoableChangeListener(VetoableChangeListener)
+	 */
+	public void testAddVetoableChangeListenerVetoableChangeListener() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		support.addVetoableChangeListener(proxy);
+
+		assertTrue(support.hasListeners("label"));
+		assertTrue(support.hasListeners("text"));
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners("label");
+		VetoableChangeListener[] listeners3 = support
+				.getVetoableChangeListeners("text");
+
+		assertEquals(1, listeners1.length);
+		assertEquals(0, listeners2.length);
+		assertEquals(0, listeners3.length);
+
+		assertSame(proxy, listeners1[0]);
+	}
+
+	/*
+	 * add a null listener
+	 */
+	public void testAddVetoableChangeListenerVetoableChangeListener_null() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+		support.addVetoableChangeListener(null);
+
+		assertTrue(support.hasListeners("label"));
+		assertTrue(support.hasListeners("text"));
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners("label");
+		VetoableChangeListener[] listeners3 = support
+				.getVetoableChangeListeners("text");
+
+		assertEquals(1, listeners1.length);
+		assertEquals(0, listeners2.length);
+		assertEquals(0, listeners3.length);
+
+		assertNull(listeners1[0]);
+	}
+
+	/*
+	 * add duplicated listeners
+	 */
+	public void testAddVetoableChangeListenerVetoableChangeListener_duplicate() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		support.addVetoableChangeListener(proxy);
+		support.addVetoableChangeListener(proxy);
+
+		assertTrue(support.hasListeners("label"));
+		assertTrue(support.hasListeners("text"));
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners("label");
+		VetoableChangeListener[] listeners3 = support
+				.getVetoableChangeListeners("text");
+
+		assertEquals(2, listeners1.length);
+		assertEquals(0, listeners2.length);
+		assertEquals(0, listeners3.length);
+		for (int i = 0; i < listeners1.length; i++) {
+			assertSame(proxy, listeners1[i]);
+		}
+	}
+
+	/*
+	 * add two different listeners
+	 */
+	public void testAddVetoableChangeListenerVetoableChangeListener_TwoDifferent() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		VetoableChangeListener proxy2 = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "getText");
+		support.addVetoableChangeListener(proxy);
+		support.addVetoableChangeListener(proxy2);
+
+		assertTrue(support.hasListeners("label"));
+		assertTrue(support.hasListeners("text"));
+
+		VetoableChangeListener[] listeners1 = support
+				.getVetoableChangeListeners();
+		VetoableChangeListener[] listeners2 = support
+				.getVetoableChangeListeners("label");
+		VetoableChangeListener[] listeners3 = support
+				.getVetoableChangeListeners("text");
+
+		assertEquals(2, listeners1.length);
+		assertEquals(0, listeners2.length);
+		assertEquals(0, listeners3.length);
+		for (int i = 0; i < listeners1.length; i++) {
+			assertTrue((proxy == listeners1[i]) || (proxy2 == listeners1[i]));
+		}
+	}
+
+	/*
+	 * add a VetoableChangeListenerProxy
+	 */
+	public void testAddVetoableChangeListenerVetoableChangeListener_Proxy() {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+
+		proxy = new MockVetoableChangeListener();
+		String propertyName = "label";
+
+		VetoableChangeListenerProxy listenerProxy = new VetoableChangeListenerProxy(
+				propertyName, proxy);
+
+		support.addVetoableChangeListener(listenerProxy);
+
+		assertTrue(support.hasListeners(propertyName));
+		assertFalse(support.hasListeners("text"));
+		{
+			VetoableChangeListener[] listeners1 = support
+					.getVetoableChangeListeners();
+			VetoableChangeListener[] listeners2 = support
+					.getVetoableChangeListeners(propertyName);
+			VetoableChangeListener[] listeners3 = support
+					.getVetoableChangeListeners("text");
+
+			assertEquals(0, listeners3.length);
+			assertEquals(1, listeners1.length);
+			assertEquals(1, listeners2.length);
+
+			assertSame(proxy, listeners2[0]);
+			VetoableChangeListenerProxy wrappers = (VetoableChangeListenerProxy) listeners1[0];
+			assertSame(proxy, wrappers.getListener());
+			assertEquals(propertyName, wrappers.getPropertyName());
+		}
+		// add test for remove proxy
+		support.removeVetoableChangeListener(listenerProxy);
+		{
+			VetoableChangeListener[] listeners1 = support
+					.getVetoableChangeListeners();
+			VetoableChangeListener[] listeners2 = support
+					.getVetoableChangeListeners(propertyName);
+			assertEquals(0, listeners1.length);
+			assertEquals(0, listeners2.length);
+		}
+
+	}
+
+	/*
+	 * Class under test for void fireVetoableChange(PropertyChangeEvent)
+	 */
+	public void testFireVetoableChangePropertyChangeEvent()
+			throws PropertyVetoException {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		support.addVetoableChangeListener(proxy);
+		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
+				"Label: old", "Label: new");
+		support.fireVetoableChange(event);
+
+		assertEquals("called", source.getText());
+	}
+
+	public void testFireVetoableChangePropertyChangeEvent_Veto()
+			throws PropertyVetoException {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		MockVetoListener normal1 = new MockVetoListener(false, "Norm1");
+		support.addVetoableChangeListener(normal1);
+
+		MockVetoListener veto1 = new MockVetoListener(true, "Veto1");
+		support.addVetoableChangeListener(veto1);
+
+		MockVetoListener normal2 = new MockVetoListener(false, "Norm2");
+		support.addVetoableChangeListener(normal2);
+
+		MockVetoListener veto2 = new MockVetoListener(true, "Veto2");
+		support.addVetoableChangeListener(veto2);
+
+		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
+				"1", "5");
+		try {
+			support.fireVetoableChange(event);
+		} catch (PropertyVetoException e) {
+
+		}
+
+		assertEquals(4, support.getVetoableChangeListeners().length);
+
+		// Check the calling status of the first listener
+		{
+			ArrayList oldValues = normal1.getOldValues();
+			assertEquals(2, oldValues.size());
+			assertEquals("1", oldValues.get(0));
+			assertEquals("5", oldValues.get(1));
+
+			ArrayList newValues = normal1.getNewValues();
+			assertEquals(2, newValues.size());
+			assertEquals("5", newValues.get(0));
+			assertEquals("1", newValues.get(1));
+		}
+
+		// Check the status of the second (Veto) listeners
+		{
+			ArrayList oldValues = veto1.getOldValues();
+			assertEquals(2, oldValues.size());
+			assertEquals("1", oldValues.get(0));
+			assertEquals("5", oldValues.get(1));
+
+			ArrayList newValues = veto1.getNewValues();
+			assertEquals(2, newValues.size());
+			assertEquals("5", newValues.get(0));
+			assertEquals("1", newValues.get(1));
+		}
+
+		// Check the status of the third listeners
+		{
+			ArrayList oldValues = normal2.getOldValues();
+			assertEquals(1, oldValues.size());
+			assertEquals("5", oldValues.get(0));
+
+			ArrayList newValues = normal2.getNewValues();
+			assertEquals(1, newValues.size());
+			assertEquals("1", newValues.get(0));
+		}
+
+		// Check the status of the fourth (Veto) listeners
+		{
+			ArrayList oldValues = veto2.getOldValues();
+			assertEquals(1, oldValues.size());
+			assertEquals("5", oldValues.get(0));
+
+			ArrayList newValues = veto2.getNewValues();
+			assertEquals(1, newValues.size());
+			assertEquals("1", newValues.get(0));
+		}
+	}
+
+	/*
+	 * fire a null event
+	 */
+	public void testFireVetoableChangePropertyChangeEvent_null()
+			throws PropertyVetoException {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+		support.addVetoableChangeListener(proxy);
+		try {
+			support.fireVetoableChange(null);
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+			// expected
+		}
+	}
+
+	/*
+	 * register for one property
+	 */
+	public void testFireVetoableChangePropertyChangeEvent_property()
+			throws PropertyVetoException {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+
+		String propertyName = "label";
+		support.addVetoableChangeListener(propertyName, proxy);
+		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
+				"Label: old", "Label: new");
+		support.fireVetoableChange(event);
+
+		assertEquals("called", source.getText());
+	}
+
+	public void testFireVetoableChangePropertyChangeEvent_property_invalid()
+			throws PropertyVetoException {
+		MockSource source = new MockSource();
+		VetoableChangeSupport support = new VetoableChangeSupport(source);
+
+		VetoableChangeListener proxy = (VetoableChangeListener) EventHandler
+				.create(VetoableChangeListener.class, source, "setText");
+
+		String propertyName = "label_invalid";
+		support.addVetoableChangeListener(propertyName, proxy);
+		PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
+				"Label: old", "Label: new");
+		support.fireVetoableChange(event);
+
+		assertEquals("text.default", source.getText());
+	}
+

[... 1331 lines stripped ...]


Mime
View raw message