harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r412641 [17/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/PropertyChangeEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.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/PropertyChangeEventTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeEventTest.java
Wed Jun  7 20:40:24 2006
@@ -1,179 +1,179 @@
-/* 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.PropertyChangeEvent;
-import java.beans.PropertyChangeSupport;
-import java.util.EventObject;
-
-import tests.util.SerializationTester;
-
-import junit.framework.TestCase;
-
-/**
- * Test class java.beans.PropertyChangeEvent.
- */
-public class PropertyChangeEventTest extends TestCase {
-	/*
-	 * Test the constructor with normal parameters.
-	 */
-	public void testConstructor_Normal() {
-		Object src = new Object();
-		Object oldValue = new Object();
-		Object newValue = new Object();
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		assertTrue(event instanceof EventObject);
-		assertSame(src, event.getSource());
-		assertEquals("myPropName", event.getPropertyName());
-		assertSame(oldValue, event.getOldValue());
-		assertSame(newValue, event.getNewValue());
-		assertNull(event.getPropagationId());
-	}
-
-	/*
-	 * Test the constructor with null parameters except the source parameter.
-	 */
-	public void testConstructor_Null() {
-		Object src = new Object();
-		PropertyChangeEvent event = new PropertyChangeEvent(src, null, null,
-				null);
-		assertSame(src, event.getSource());
-		assertEquals(null, event.getPropertyName());
-		assertSame(null, event.getOldValue());
-		assertSame(null, event.getNewValue());
-		assertNull(event.getPropagationId());
-	}
-
-	/*
-	 * Test the constructor with null properties but non-null old and new
-	 * values.
-	 */
-	public void testConstructor_NullProperty() {
-		Object src = new Object();
-		Object oldValue = new Object();
-		Object newValue = new Object();
-		PropertyChangeEvent event = new PropertyChangeEvent(src, null,
-				oldValue, newValue);
-		assertSame(src, event.getSource());
-		assertEquals(null, event.getPropertyName());
-		assertSame(oldValue, event.getOldValue());
-		assertSame(newValue, event.getNewValue());
-		assertNull(event.getPropagationId());
-	}
-
-	/*
-	 * Test the constructor with null source parameter.
-	 */
-	public void testConstructor_NullSrc() {
-		try {
-			new PropertyChangeEvent(null, "prop", new Object(), new Object());
-			fail("Should throw IllegalArgumentException!");
-		} catch (IllegalArgumentException ex) {
-			// expected
-		}
-	}
-
-	/*
-	 * Test the method setPropagationId() with a normal value.
-	 */
-	public void testSetPropagationId_Normal() {
-		Object src = new Object();
-		Object oldValue = new Object();
-		Object newValue = new Object();
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		assertNull(event.getPropagationId());
-
-		Object pid = new Object();
-		event.setPropagationId(pid);
-
-		assertSame(src, event.getSource());
-		assertEquals("myPropName", event.getPropertyName());
-		assertSame(oldValue, event.getOldValue());
-		assertSame(newValue, event.getNewValue());
-		assertSame(pid, event.getPropagationId());
-	}
-
-	/*
-	 * Test the method setPropagationId() with a null value.
-	 */
-	public void testSetPropagationId_Null() {
-		Object src = new Object();
-		Object oldValue = new Object();
-		Object newValue = new Object();
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		assertNull(event.getPropagationId());
-
-		// set null when already null
-		event.setPropagationId(null);
-		assertNull(event.getPropagationId());
-
-		// set a non-null value
-		Object pid = new Object();
-		event.setPropagationId(pid);
-		assertSame(src, event.getSource());
-		assertEquals("myPropName", event.getPropertyName());
-		assertSame(oldValue, event.getOldValue());
-		assertSame(newValue, event.getNewValue());
-		assertSame(pid, event.getPropagationId());
-
-		// reset to null
-		event.setPropagationId(null);
-		assertNull(event.getPropagationId());
-	}
-
-	/*
-	 * Test serialization/deserialization.
-	 */
-	public void testSerialization() throws Exception {
-		Object src = new Object();
-		Object oldValue = "oldValue";
-		Object newValue = "newValue";
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		PropertyChangeEvent deEvent = (PropertyChangeEvent) SerializationTester
-				.getDeserilizedObject(event);
-		assertEquals(event.getNewValue(), deEvent.getNewValue());
-		assertEquals(event.getOldValue(), deEvent.getOldValue());
-		assertEquals(event.getPropagationId(), deEvent.getPropagationId());
-		assertEquals(event.getPropertyName(), deEvent.getPropertyName());
-	}
-
-	/*
-	 * Test serialization compatibility.
-	 */
-	public void testSerializationCompatibility() throws Exception {
-		Object src = new Object();
-		Object oldValue = "oldValue";
-		Object newValue = "newValue";
-
-		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
-				oldValue, newValue);
-		PropertyChangeEvent deEvent = (PropertyChangeEvent) SerializationTester
-				.readObject(event,
-						"serialization/java/beans/PropertyChangeEvent.ser");
-		assertEquals(event.getNewValue(), deEvent.getNewValue());
-		assertEquals(event.getOldValue(), deEvent.getOldValue());
-		assertEquals(event.getPropagationId(), deEvent.getPropagationId());
-		assertEquals(event.getPropertyName(), deEvent.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.PropertyChangeEvent;
+import java.beans.PropertyChangeSupport;
+import java.util.EventObject;
+
+import tests.util.SerializationTester;
+
+import junit.framework.TestCase;
+
+/**
+ * Test class java.beans.PropertyChangeEvent.
+ */
+public class PropertyChangeEventTest extends TestCase {
+	/*
+	 * Test the constructor with normal parameters.
+	 */
+	public void testConstructor_Normal() {
+		Object src = new Object();
+		Object oldValue = new Object();
+		Object newValue = new Object();
+
+		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
+				oldValue, newValue);
+		assertTrue(event instanceof EventObject);
+		assertSame(src, event.getSource());
+		assertEquals("myPropName", event.getPropertyName());
+		assertSame(oldValue, event.getOldValue());
+		assertSame(newValue, event.getNewValue());
+		assertNull(event.getPropagationId());
+	}
+
+	/*
+	 * Test the constructor with null parameters except the source parameter.
+	 */
+	public void testConstructor_Null() {
+		Object src = new Object();
+		PropertyChangeEvent event = new PropertyChangeEvent(src, null, null,
+				null);
+		assertSame(src, event.getSource());
+		assertEquals(null, event.getPropertyName());
+		assertSame(null, event.getOldValue());
+		assertSame(null, event.getNewValue());
+		assertNull(event.getPropagationId());
+	}
+
+	/*
+	 * Test the constructor with null properties but non-null old and new
+	 * values.
+	 */
+	public void testConstructor_NullProperty() {
+		Object src = new Object();
+		Object oldValue = new Object();
+		Object newValue = new Object();
+		PropertyChangeEvent event = new PropertyChangeEvent(src, null,
+				oldValue, newValue);
+		assertSame(src, event.getSource());
+		assertEquals(null, event.getPropertyName());
+		assertSame(oldValue, event.getOldValue());
+		assertSame(newValue, event.getNewValue());
+		assertNull(event.getPropagationId());
+	}
+
+	/*
+	 * Test the constructor with null source parameter.
+	 */
+	public void testConstructor_NullSrc() {
+		try {
+			new PropertyChangeEvent(null, "prop", new Object(), new Object());
+			fail("Should throw IllegalArgumentException!");
+		} catch (IllegalArgumentException ex) {
+			// expected
+		}
+	}
+
+	/*
+	 * Test the method setPropagationId() with a normal value.
+	 */
+	public void testSetPropagationId_Normal() {
+		Object src = new Object();
+		Object oldValue = new Object();
+		Object newValue = new Object();
+
+		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
+				oldValue, newValue);
+		assertNull(event.getPropagationId());
+
+		Object pid = new Object();
+		event.setPropagationId(pid);
+
+		assertSame(src, event.getSource());
+		assertEquals("myPropName", event.getPropertyName());
+		assertSame(oldValue, event.getOldValue());
+		assertSame(newValue, event.getNewValue());
+		assertSame(pid, event.getPropagationId());
+	}
+
+	/*
+	 * Test the method setPropagationId() with a null value.
+	 */
+	public void testSetPropagationId_Null() {
+		Object src = new Object();
+		Object oldValue = new Object();
+		Object newValue = new Object();
+
+		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
+				oldValue, newValue);
+		assertNull(event.getPropagationId());
+
+		// set null when already null
+		event.setPropagationId(null);
+		assertNull(event.getPropagationId());
+
+		// set a non-null value
+		Object pid = new Object();
+		event.setPropagationId(pid);
+		assertSame(src, event.getSource());
+		assertEquals("myPropName", event.getPropertyName());
+		assertSame(oldValue, event.getOldValue());
+		assertSame(newValue, event.getNewValue());
+		assertSame(pid, event.getPropagationId());
+
+		// reset to null
+		event.setPropagationId(null);
+		assertNull(event.getPropagationId());
+	}
+
+	/*
+	 * Test serialization/deserialization.
+	 */
+	public void testSerialization() throws Exception {
+		Object src = new Object();
+		Object oldValue = "oldValue";
+		Object newValue = "newValue";
+
+		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
+				oldValue, newValue);
+		PropertyChangeEvent deEvent = (PropertyChangeEvent) SerializationTester
+				.getDeserilizedObject(event);
+		assertEquals(event.getNewValue(), deEvent.getNewValue());
+		assertEquals(event.getOldValue(), deEvent.getOldValue());
+		assertEquals(event.getPropagationId(), deEvent.getPropagationId());
+		assertEquals(event.getPropertyName(), deEvent.getPropertyName());
+	}
+
+	/*
+	 * Test serialization compatibility.
+	 */
+	public void testSerializationCompatibility() throws Exception {
+		Object src = new Object();
+		Object oldValue = "oldValue";
+		Object newValue = "newValue";
+
+		PropertyChangeEvent event = new PropertyChangeEvent(src, "myPropName",
+				oldValue, newValue);
+		PropertyChangeEvent deEvent = (PropertyChangeEvent) SerializationTester
+				.readObject(event,
+						"serialization/java/beans/PropertyChangeEvent.ser");
+		assertEquals(event.getNewValue(), deEvent.getNewValue());
+		assertEquals(event.getOldValue(), deEvent.getOldValue());
+		assertEquals(event.getPropagationId(), deEvent.getPropagationId());
+		assertEquals(event.getPropertyName(), deEvent.getPropertyName());
+	}
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeListenerProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeListenerProxyTest.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/PropertyChangeListenerProxyTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeListenerProxyTest.java
Wed Jun  7 20:40:24 2006
@@ -1,94 +1,94 @@
-/* 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.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeListenerProxy;
-
-import junit.framework.TestCase;
-
-/**
- * Test for PropertyChangeListenerProxy
- */
-public class PropertyChangeListenerProxyTest extends TestCase {
-
-	PropertyChangeListenerProxy proxy;
-
-	PropertyChangeListener listener = new MockPropertyChangeListener();
-
-	String name = "mock";
-
-	static PropertyChangeEvent event = null;
-
-	protected void setUp() throws Exception {
-		super.setUp();
-		proxy = new PropertyChangeListenerProxy(name, listener);
-	}
-
-	public void testPropertyChangeListenerProxy() {
-		proxy = new PropertyChangeListenerProxy(null, listener);
-		assertSame(listener, proxy.getListener());
-		assertNull(proxy.getPropertyName());
-		PropertyChangeEvent newevent = new PropertyChangeEvent(new Object(),
-				"name", new Object(), new Object());
-		proxy.propertyChange(newevent);
-		assertSame(newevent, event);
-		proxy = new PropertyChangeListenerProxy(name, null);
-		assertSame(name, proxy.getPropertyName());
-		assertNull(proxy.getListener());
-		try {
-			proxy.propertyChange(new PropertyChangeEvent(new Object(), "name",
-					new Object(), new Object()));
-            fail("NullPointerException expected");
-		} catch (NullPointerException e) {
-		}
-
-		proxy = new PropertyChangeListenerProxy(name, listener);
-		assertSame(listener, proxy.getListener());
-		assertSame(name, proxy.getPropertyName());
-		newevent = new PropertyChangeEvent(new Object(), "name", new Object(),
-				new Object());
-		assertSame(name, proxy.getPropertyName());
-		proxy.propertyChange(newevent);
-		assertSame(newevent, event);
-	}
-
-	public void testPropertyChange() {
-		proxy.propertyChange(null);
-		assertNull(event);
-	}
-
-    /**
-     * Regression for HARMONY-407
-     */
-    public void testPropertyChange_PropertyChangeEvent() {
-        PropertyChangeListenerProxy proxy = new PropertyChangeListenerProxy(
-                "harmony", null);
-        try {
-            proxy.propertyChange(null);
-            fail("NullPointerException expected");
-        } catch (NullPointerException e) {}
-    }         
-
-    public static class MockPropertyChangeListener implements
-			PropertyChangeListener {
-		public void propertyChange(PropertyChangeEvent newevent) {
-			event = newevent;
-		}
-	}
-
-}
+/* 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.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeListenerProxy;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for PropertyChangeListenerProxy
+ */
+public class PropertyChangeListenerProxyTest extends TestCase {
+
+	PropertyChangeListenerProxy proxy;
+
+	PropertyChangeListener listener = new MockPropertyChangeListener();
+
+	String name = "mock";
+
+	static PropertyChangeEvent event = null;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		proxy = new PropertyChangeListenerProxy(name, listener);
+	}
+
+	public void testPropertyChangeListenerProxy() {
+		proxy = new PropertyChangeListenerProxy(null, listener);
+		assertSame(listener, proxy.getListener());
+		assertNull(proxy.getPropertyName());
+		PropertyChangeEvent newevent = new PropertyChangeEvent(new Object(),
+				"name", new Object(), new Object());
+		proxy.propertyChange(newevent);
+		assertSame(newevent, event);
+		proxy = new PropertyChangeListenerProxy(name, null);
+		assertSame(name, proxy.getPropertyName());
+		assertNull(proxy.getListener());
+		try {
+			proxy.propertyChange(new PropertyChangeEvent(new Object(), "name",
+					new Object(), new Object()));
+            fail("NullPointerException expected");
+		} catch (NullPointerException e) {
+		}
+
+		proxy = new PropertyChangeListenerProxy(name, listener);
+		assertSame(listener, proxy.getListener());
+		assertSame(name, proxy.getPropertyName());
+		newevent = new PropertyChangeEvent(new Object(), "name", new Object(),
+				new Object());
+		assertSame(name, proxy.getPropertyName());
+		proxy.propertyChange(newevent);
+		assertSame(newevent, event);
+	}
+
+	public void testPropertyChange() {
+		proxy.propertyChange(null);
+		assertNull(event);
+	}
+
+    /**
+     * Regression for HARMONY-407
+     */
+    public void testPropertyChange_PropertyChangeEvent() {
+        PropertyChangeListenerProxy proxy = new PropertyChangeListenerProxy(
+                "harmony", null);
+        try {
+            proxy.propertyChange(null);
+            fail("NullPointerException expected");
+        } catch (NullPointerException e) {}
+    }         
+
+    public static class MockPropertyChangeListener implements
+			PropertyChangeListener {
+		public void propertyChange(PropertyChangeEvent newevent) {
+			event = newevent;
+		}
+	}
+
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeListenerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeListenerTest.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/PropertyChangeListenerTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyChangeListenerTest.java
Wed Jun  7 20:40:24 2006
@@ -1,39 +1,39 @@
-/* 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.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import junit.framework.TestCase;
-
-/**
- * Test the signature of the interface PropertyChangeListener.
- * 
- */
-public class PropertyChangeListenerTest extends TestCase {
-
-	public void testSignature() {
-		DummyPropertyChangeListener o = new DummyPropertyChangeListener();
-		assertTrue(o instanceof PropertyChangeListener);
-	}
-
-	static class DummyPropertyChangeListener implements PropertyChangeListener {
-
-		public void propertyChange(PropertyChangeEvent event) {
-		}
-	}
-}
+/* 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.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the signature of the interface PropertyChangeListener.
+ * 
+ */
+public class PropertyChangeListenerTest extends TestCase {
+
+	public void testSignature() {
+		DummyPropertyChangeListener o = new DummyPropertyChangeListener();
+		assertTrue(o instanceof PropertyChangeListener);
+	}
+
+	static class DummyPropertyChangeListener implements PropertyChangeListener {
+
+		public void propertyChange(PropertyChangeEvent event) {
+		}
+	}
+}



Mime
View raw message