harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r417685 [10/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/har...
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/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=417685&r1=417684&r2=417685&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 28 00:22:12 2006
@@ -33,9 +33,10 @@
 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 org.apache.harmony.beans.tests.support.beancontext.mock.MockVetoableChangeListener;
+import org.apache.harmony.beans.tests.support.mock.NonSerializedVCListener;
+import org.apache.harmony.beans.tests.support.mock.SerializedVCListener;
+
 import tests.util.SerializationTester;
 
 /**
@@ -43,1479 +44,1471 @@
  */
 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);
-	}
+    /*
+     * Constructor a VetoableChangeSupport instance with normal input
+     */
+    public void testVetoableChangeSupport() {
+        MockSource source = new MockSource();
+        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 = 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 = 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 = 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 = 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 = EventHandler.create(
+                VetoableChangeListener.class, source, "setText");
+        VetoableChangeListener proxy2 = 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 = 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 = 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 = EventHandler.create(
+                VetoableChangeListener.class, source, "setText");
+        VetoableChangeListener proxy2 = 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 = 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 = 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 = 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 = 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 = 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 = EventHandler.create(
+                VetoableChangeListener.class, source, "increaseTop");
+        VetoableChangeListener proxy2 = 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 = 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 = 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);
+
+        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 = EventHandler.create(
+                VetoableChangeListener.class, source, "setText");
+        VetoableChangeListener proxy2 = 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 = EventHandler.create(
+                VetoableChangeListener.class, source, "setText");
+        VetoableChangeListener proxy2 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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()

[... 1178 lines stripped ...]


Mime
View raw message