harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r412641 [20/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/PropertyEditorManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerTest.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/PropertyEditorManagerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorManagerTest.java Wed Jun  7 20:40:24 2006
@@ -1,745 +1,745 @@
-/* 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.awt.Component;
-import java.awt.Graphics;
-import java.awt.Rectangle;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-import org.apache.harmony.beans.tests.java.beans.mock.Foz;
-import org.apache.harmony.beans.tests.java.beans.mock.FozDefault;
-import org.apache.harmony.beans.tests.java.beans.mock.Fozz;
-import org.apache.harmony.beans.tests.java.beans.mock.FozzEditor;
-import org.apache.harmony.beans.tests.java.beans.mock.Fozzz;
-import org.apache.harmony.beans.tests.java.beans.mock.MockButton;
-import org.apache.harmony.beans.tests.java.beans.mock.MockFoo;
-
-import org.apache.harmony.beans.tests.java.beans.auxiliary.AnotherSampleProperty;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.SampleProperty;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.SamplePropertyEditor;
-import org.apache.harmony.beans.tests.java.beans.auxiliary.OtherEditor;
-
-import org.apache.harmony.beans.tests.java.beans.editors.AnotherSamplePropertyEditor;
-
-
-/**
- * Unit test for PropertyEditorManager
- */
-public class PropertyEditorManagerTest extends TestCase {
-
-	/*
-	 * Constructors
-	 */
-	public void testPropertyEditorManager() {
-		PropertyEditorManager managers = new PropertyEditorManager();
-	}
-
-	/*
-	 * find the editor which has been registered through registerEditor.
-	 */
-	public void testFindEditor_registered() {
-		Class editorClass = FozRegisteredEditor.class;
-		Class type = Foz.class;
-		PropertyEditorManager.registerEditor(type, editorClass);
-		PropertyEditor editor = PropertyEditorManager.findEditor(type);
-		assertTrue(editor instanceof FozRegisteredEditor);
-		assertEquals(editorClass, editor.getClass());
-	}
-
-	/*
-	 * Find editor of which name is XXXEditor in the same package
-	 */
-	public void testFindEditor_SamePackage() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Fozz.class);
-		assertTrue(editor instanceof FozzEditor);
-		assertEquals(FozzEditor.class, editor.getClass());
-	}
-
-	/*
-	 * Find editor in search path
-	 */
-	public void testFindEditor_DifferentPackage() {
-		String[] original = PropertyEditorManager.getEditorSearchPath();
-		PropertyEditorManager
-				.setEditorSearchPath(new String[] { "org.apache.harmony.beans.tests.java.beans" });
-		PropertyEditor editor = PropertyEditorManager.findEditor(Fozzz.class);
-		assertTrue(editor instanceof FozzzEditor);
-		assertEquals(FozzzEditor.class, editor.getClass());
-
-		PropertyEditorManager.setEditorSearchPath(original);
-	}
-
-	/*
-	 * Find editor for Java primitive types and java.lang.String.
-	 * java.awt.Color, and java.awt.Font
-	 */
-	public void testFindEditor_DefaultType() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
-	}
-
-    //Regression test for HARMONY-258
-	public void testFindEditor_TypeNull() {
-		try {
-			PropertyEditorManager.findEditor(null);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	public void testFindEditor_TypeNoEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(MockFoo.class);
-		assertNull(editor);
-	}
-
-	public void testGetEditorSearchPath_default() {
-		String[] path = PropertyEditorManager.getEditorSearchPath();
-		assertEquals(1, path.length);
-		assertEquals("sun.beans.editors", path[0]);
-	}
-
-	public void testGetEditorSearchPath() {
-		String[] original = PropertyEditorManager.getEditorSearchPath();
-
-		String[] path = new String[] { "java.beans",
-				"org.apache.harmony.beans.tests.java.beans.editor", "", };
-		PropertyEditorManager.setEditorSearchPath(path);
-		String[] newPath = PropertyEditorManager.getEditorSearchPath();
-
-		assertTrue(Arrays.equals(path, newPath));
-
-		PropertyEditorManager.setEditorSearchPath(original);
-	}
-
-	/*
-	 * RegisterEditor
-	 */
-	public void testRegisterEditor() {
-		Class type = MockButton.class;
-
-		PropertyEditorManager.registerEditor(type, ButtonEditor.class);
-		PropertyEditor editor = PropertyEditorManager.findEditor(type);
-		assertEquals(ButtonEditor.class, editor.getClass());
-
-		PropertyEditorManager.registerEditor(type, FozRegisteredEditor.class);
-		editor = PropertyEditorManager.findEditor(type);
-		assertEquals(FozRegisteredEditor.class, editor.getClass());
-
-		PropertyEditorManager.registerEditor(type, null);
-		editor = PropertyEditorManager.findEditor(type);
-		assertNull(editor);
-	}
-
-	/*
-	 * registerEditor for type null
-     * Regression test for HARMONY-258
-	 */
-	public void testRegisterEditorType_Null() {
-		try {
-			PropertyEditorManager.registerEditor(null, ButtonEditor.class);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * set search path as {null}
-	 */
-	public void testSetEditorSearchPath_nullpath() {
-		String[] original = PropertyEditorManager.getEditorSearchPath();
-		PropertyEditorManager.setEditorSearchPath(new String[] { null });
-		assertEquals(1, PropertyEditorManager.getEditorSearchPath().length);
-		assertNull(PropertyEditorManager.getEditorSearchPath()[0]);
-		PropertyEditorManager.setEditorSearchPath(original);
-	}
-
-	/*
-	 * set search null
-	 */
-	public void testSetEditorSearchPath_null() {
-		String[] original = PropertyEditorManager.getEditorSearchPath();
-		PropertyEditorManager.setEditorSearchPath(null);
-		assertEquals(0, PropertyEditorManager.getEditorSearchPath().length);
-		PropertyEditorManager.setEditorSearchPath(original);
-	}
-
-	// Test internal Editor
-	public void testBoolEditor_setAsText() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Boolean.TYPE);
-		editor.setAsText("false");
-		assertEquals("false", editor.getAsText().toLowerCase());
-		assertEquals("false", editor.getJavaInitializationString());
-		assertEquals("True", editor.getTags()[0]);
-		assertEquals("False", editor.getTags()[1]);
-		assertEquals(Boolean.FALSE, editor.getValue());
-
-		editor.setAsText("TrUE");
-		assertEquals("true", editor.getAsText().toLowerCase());
-		assertEquals("true", editor.getJavaInitializationString());
-		assertEquals(Boolean.TRUE, editor.getValue());
-	}
-
-	public void testBoolEditor_setAsText_null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Boolean.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a Exception");
-		} catch (Exception e) {
-		}
-	}
-
-	public void testBoolEditor_setAsText_Invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Boolean.TYPE);
-		try {
-			editor.setAsText("***true***");
-			fail("Should throw a IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-		}
-	}
-
-	public void testByteEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
-		byte b = (byte) 0x7F;
-		editor.setAsText(Byte.toString(b));
-		assertEquals(Byte.toString(b), editor.getAsText());
-		assertEquals("((byte)127)", editor.getJavaInitializationString());
-		assertEquals(new Byte(b), editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testByteEditor_null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testByteEditor_invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
-		try {
-			editor.setAsText("invalid");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testByteEditor_invalid2() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
-		try {
-			editor.setAsText("128");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testDoubleEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Double.TYPE);
-		double d = 12345.678;
-		editor.setAsText(Double.toString(d));
-		assertEquals(Double.toString(d), editor.getAsText());
-		assertEquals(Double.toString(d), editor.getJavaInitializationString());
-		assertEquals(new Double(d), editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testDoubleEditor_SetAsText_Null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Double.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a NullPointerException");
-		} catch (NullPointerException e) {
-
-		}
-	}
-
-	public void testDoubleEditor_SetAsText_Invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Double.TYPE);
-		try {
-			editor.setAsText("invalid");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testFloatEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Float.TYPE);
-		float f = 12345.678f;
-		String text = Float.toString(f);
-		editor.setAsText(text);
-		assertEquals(text, editor.getAsText());
-		assertEquals(text + "F", editor.getJavaInitializationString());
-		assertEquals(new Float(f), editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testFloatEditor_SetAsText_Null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Float.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a NullPointerException");
-		} catch (NullPointerException e) {
-
-		}
-	}
-
-	public void testFloatEditor_SetAsText_Invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Float.TYPE);
-		try {
-			editor.setAsText("invalid");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testLongEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Long.TYPE);
-		long l = 123456789;
-		String text = Long.toString(l);
-		editor.setAsText(text);
-		assertEquals(text, editor.getAsText());
-		assertEquals(text + "L", editor.getJavaInitializationString());
-		assertEquals(new Long(l), editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testLongEditor_SetAsText_Null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Long.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testLongEditor_SetAsText_Invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Long.TYPE);
-		try {
-			editor.setAsText("invalid");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testShortEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Short.TYPE);
-		short s = (short) 123456789;
-		String text = Short.toString(s);
-		editor.setAsText(text);
-		assertEquals(text, editor.getAsText());
-		assertEquals("((short)" + text + ")", editor
-				.getJavaInitializationString());
-		assertEquals(new Short(s), editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testShortEditor_SetAsText_Null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Short.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testShortEditor_SetAsText_Invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Short.TYPE);
-		try {
-			editor.setAsText("invalid");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testIntegerEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
-		int i = 123456789;
-		String text = Integer.toString(i);
-		editor.setAsText(text);
-		assertEquals(text, editor.getAsText());
-		assertEquals(text, editor.getJavaInitializationString());
-		assertEquals(new Integer(i), editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testIntegerEditor_SetAsText_Null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
-		try {
-			editor.setAsText(null);
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testIntegerEditor_SetAsText_Invalid() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
-		try {
-			editor.setAsText("invalid");
-			fail("Should throw a NumberFormatException");
-		} catch (NumberFormatException e) {
-
-		}
-	}
-
-	public void testStringEditor() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(String.class);
-		String text = "A sample string";
-		editor.setAsText(text);
-		assertEquals(text, editor.getAsText());
-		assertEquals("\"" + text + "\"", editor.getJavaInitializationString());
-		assertEquals(text, editor.getValue());
-		assertNull(editor.getTags());
-	}
-
-	public void testStringEditor_SetAsText_Null() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(String.class);
-
-		editor.setAsText("null");
-		assertEquals("null", editor.getAsText());
-		assertEquals("\"null\"", editor.getJavaInitializationString());
-		assertEquals("null", editor.getValue());
-
-		editor.setAsText("");
-		assertEquals("", editor.getAsText());
-		assertEquals("\"\"", editor.getJavaInitializationString());
-
-		editor.setAsText(null);
-		assertEquals("null", editor.getAsText());
-		assertEquals("null", editor.getJavaInitializationString());
-		assertNull(editor.getValue());
-	}
-
-	public void testStringEditor_SetAsText_SpecialChars() {
-		PropertyEditor editor = PropertyEditorManager.findEditor(String.class);
-		String str = "\n\t\\a\"";
-		editor.setAsText(str);
-		assertEquals(str, editor.getAsText());
-		assertEquals("\"\\n\\u0009\\\\a\\\"\"", editor
-				.getJavaInitializationString());
-	}
-
-	public static class FozRegisteredEditor implements PropertyEditor {
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#addPropertyChangeListener(java.beans.PropertyChangeListener)
-		 */
-		public void addPropertyChangeListener(PropertyChangeListener listener) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getAsText()
-		 */
-		public String getAsText() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getCustomEditor()
-		 */
-		public Component getCustomEditor() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getJavaInitializationString()
-		 */
-		public String getJavaInitializationString() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getTags()
-		 */
-		public String[] getTags() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getValue()
-		 */
-		public Object getValue() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#isPaintable()
-		 */
-		public boolean isPaintable() {
-			// TO DO Auto-generated method stub
-			return false;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#paintValue(java.awt.Graphics,
-		 *      java.awt.Rectangle)
-		 */
-		public void paintValue(Graphics graphics, Rectangle box) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#removePropertyChangeListener(java.beans.PropertyChangeListener)
-		 */
-		public void removePropertyChangeListener(PropertyChangeListener listener) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#setAsText(java.lang.String)
-		 */
-		public void setAsText(String text) throws IllegalArgumentException {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#setValue(java.lang.Object)
-		 */
-		public void setValue(Object value) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#supportsCustomEditor()
-		 */
-		public boolean supportsCustomEditor() {
-			// TO DO Auto-generated method stub
-			return false;
-		}
-
-	}
-
-	public static class ButtonEditor implements PropertyEditor {
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#addPropertyChangeListener(java.beans.PropertyChangeListener)
-		 */
-		public void addPropertyChangeListener(PropertyChangeListener listener) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getAsText()
-		 */
-		public String getAsText() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getCustomEditor()
-		 */
-		public Component getCustomEditor() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getJavaInitializationString()
-		 */
-		public String getJavaInitializationString() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getTags()
-		 */
-		public String[] getTags() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#getValue()
-		 */
-		public Object getValue() {
-			// TO DO Auto-generated method stub
-			return null;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#isPaintable()
-		 */
-		public boolean isPaintable() {
-			// TO DO Auto-generated method stub
-			return false;
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#paintValue(java.awt.Graphics,
-		 *      java.awt.Rectangle)
-		 */
-		public void paintValue(Graphics graphics, Rectangle box) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#removePropertyChangeListener(java.beans.PropertyChangeListener)
-		 */
-		public void removePropertyChangeListener(PropertyChangeListener listener) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#setAsText(java.lang.String)
-		 */
-		public void setAsText(String text) throws IllegalArgumentException {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#setValue(java.lang.Object)
-		 */
-		public void setValue(Object value) {
-			// TO DO Auto-generated method stub
-
-		}
-
-		/*
-		 * (non-Javadoc)
-		 * 
-		 * @see java.beans.PropertyEditor#supportsCustomEditor()
-		 */
-		public boolean supportsCustomEditor() {
-			// TO DO Auto-generated method stub
-			return false;
-		}
-
-	}
-    
-    
-    /**
-     * The test checks the method findEditor() for registered editors
-     */
-    public void testFindRegisteredEditor() {
-        PropertyEditorManager.registerEditor(SampleProperty.class,
-                OtherEditor.class);
-        PropertyEditor pe = PropertyEditorManager.findEditor(
-                SampleProperty.class);
-        if(pe == null) {
-            fail("No property editor found");
-        } else {
-            assertTrue(pe instanceof OtherEditor);
-        }
-        PropertyEditorManager.registerEditor(SampleProperty.class, null);
-    }
-    
-    /**
-     * The test checks the method findEditor() for editors found by name
-     */
-    public void testFindEditorByNameAddOn() {
-        PropertyEditor pe = PropertyEditorManager.findEditor(
-                SampleProperty.class);
-        if(pe == null) {
-            fail("No property editor found");
-        } else {
-            assertTrue(pe instanceof SamplePropertyEditor);
-        }
-    }
-    
-    /**
-     * The test checks the method findEditor() for editors on search path
-     */
-    public void testFindEditorByDefaultLocation() {
-        PropertyEditorManager.setEditorSearchPath(
-                new String[] {"org.apache.harmony.beans.tests.java.beans.editors"});
-        PropertyEditor pe = PropertyEditorManager.findEditor(
-                AnotherSampleProperty.class);
-        if(pe == null) {
-            fail("No property editor found");
-        } else {
-            assertTrue(pe instanceof AnotherSamplePropertyEditor);
-        }
-    }
-}
+/* 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.awt.Component;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+import org.apache.harmony.beans.tests.java.beans.mock.Foz;
+import org.apache.harmony.beans.tests.java.beans.mock.FozDefault;
+import org.apache.harmony.beans.tests.java.beans.mock.Fozz;
+import org.apache.harmony.beans.tests.java.beans.mock.FozzEditor;
+import org.apache.harmony.beans.tests.java.beans.mock.Fozzz;
+import org.apache.harmony.beans.tests.java.beans.mock.MockButton;
+import org.apache.harmony.beans.tests.java.beans.mock.MockFoo;
+
+import org.apache.harmony.beans.tests.java.beans.auxiliary.AnotherSampleProperty;
+import org.apache.harmony.beans.tests.java.beans.auxiliary.SampleProperty;
+import org.apache.harmony.beans.tests.java.beans.auxiliary.SamplePropertyEditor;
+import org.apache.harmony.beans.tests.java.beans.auxiliary.OtherEditor;
+
+import org.apache.harmony.beans.tests.java.beans.editors.AnotherSamplePropertyEditor;
+
+
+/**
+ * Unit test for PropertyEditorManager
+ */
+public class PropertyEditorManagerTest extends TestCase {
+
+	/*
+	 * Constructors
+	 */
+	public void testPropertyEditorManager() {
+		PropertyEditorManager managers = new PropertyEditorManager();
+	}
+
+	/*
+	 * find the editor which has been registered through registerEditor.
+	 */
+	public void testFindEditor_registered() {
+		Class editorClass = FozRegisteredEditor.class;
+		Class type = Foz.class;
+		PropertyEditorManager.registerEditor(type, editorClass);
+		PropertyEditor editor = PropertyEditorManager.findEditor(type);
+		assertTrue(editor instanceof FozRegisteredEditor);
+		assertEquals(editorClass, editor.getClass());
+	}
+
+	/*
+	 * Find editor of which name is XXXEditor in the same package
+	 */
+	public void testFindEditor_SamePackage() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Fozz.class);
+		assertTrue(editor instanceof FozzEditor);
+		assertEquals(FozzEditor.class, editor.getClass());
+	}
+
+	/*
+	 * Find editor in search path
+	 */
+	public void testFindEditor_DifferentPackage() {
+		String[] original = PropertyEditorManager.getEditorSearchPath();
+		PropertyEditorManager
+				.setEditorSearchPath(new String[] { "org.apache.harmony.beans.tests.java.beans" });
+		PropertyEditor editor = PropertyEditorManager.findEditor(Fozzz.class);
+		assertTrue(editor instanceof FozzzEditor);
+		assertEquals(FozzzEditor.class, editor.getClass());
+
+		PropertyEditorManager.setEditorSearchPath(original);
+	}
+
+	/*
+	 * Find editor for Java primitive types and java.lang.String.
+	 * java.awt.Color, and java.awt.Font
+	 */
+	public void testFindEditor_DefaultType() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
+	}
+
+    //Regression test for HARMONY-258
+	public void testFindEditor_TypeNull() {
+		try {
+			PropertyEditorManager.findEditor(null);
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+			// expected
+		}
+	}
+
+	public void testFindEditor_TypeNoEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(MockFoo.class);
+		assertNull(editor);
+	}
+
+	public void testGetEditorSearchPath_default() {
+		String[] path = PropertyEditorManager.getEditorSearchPath();
+		assertEquals(1, path.length);
+		assertEquals("sun.beans.editors", path[0]);
+	}
+
+	public void testGetEditorSearchPath() {
+		String[] original = PropertyEditorManager.getEditorSearchPath();
+
+		String[] path = new String[] { "java.beans",
+				"org.apache.harmony.beans.tests.java.beans.editor", "", };
+		PropertyEditorManager.setEditorSearchPath(path);
+		String[] newPath = PropertyEditorManager.getEditorSearchPath();
+
+		assertTrue(Arrays.equals(path, newPath));
+
+		PropertyEditorManager.setEditorSearchPath(original);
+	}
+
+	/*
+	 * RegisterEditor
+	 */
+	public void testRegisterEditor() {
+		Class type = MockButton.class;
+
+		PropertyEditorManager.registerEditor(type, ButtonEditor.class);
+		PropertyEditor editor = PropertyEditorManager.findEditor(type);
+		assertEquals(ButtonEditor.class, editor.getClass());
+
+		PropertyEditorManager.registerEditor(type, FozRegisteredEditor.class);
+		editor = PropertyEditorManager.findEditor(type);
+		assertEquals(FozRegisteredEditor.class, editor.getClass());
+
+		PropertyEditorManager.registerEditor(type, null);
+		editor = PropertyEditorManager.findEditor(type);
+		assertNull(editor);
+	}
+
+	/*
+	 * registerEditor for type null
+     * Regression test for HARMONY-258
+	 */
+	public void testRegisterEditorType_Null() {
+		try {
+			PropertyEditorManager.registerEditor(null, ButtonEditor.class);
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+			// expected
+		}
+	}
+
+	/*
+	 * set search path as {null}
+	 */
+	public void testSetEditorSearchPath_nullpath() {
+		String[] original = PropertyEditorManager.getEditorSearchPath();
+		PropertyEditorManager.setEditorSearchPath(new String[] { null });
+		assertEquals(1, PropertyEditorManager.getEditorSearchPath().length);
+		assertNull(PropertyEditorManager.getEditorSearchPath()[0]);
+		PropertyEditorManager.setEditorSearchPath(original);
+	}
+
+	/*
+	 * set search null
+	 */
+	public void testSetEditorSearchPath_null() {
+		String[] original = PropertyEditorManager.getEditorSearchPath();
+		PropertyEditorManager.setEditorSearchPath(null);
+		assertEquals(0, PropertyEditorManager.getEditorSearchPath().length);
+		PropertyEditorManager.setEditorSearchPath(original);
+	}
+
+	// Test internal Editor
+	public void testBoolEditor_setAsText() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Boolean.TYPE);
+		editor.setAsText("false");
+		assertEquals("false", editor.getAsText().toLowerCase());
+		assertEquals("false", editor.getJavaInitializationString());
+		assertEquals("True", editor.getTags()[0]);
+		assertEquals("False", editor.getTags()[1]);
+		assertEquals(Boolean.FALSE, editor.getValue());
+
+		editor.setAsText("TrUE");
+		assertEquals("true", editor.getAsText().toLowerCase());
+		assertEquals("true", editor.getJavaInitializationString());
+		assertEquals(Boolean.TRUE, editor.getValue());
+	}
+
+	public void testBoolEditor_setAsText_null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Boolean.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a Exception");
+		} catch (Exception e) {
+		}
+	}
+
+	public void testBoolEditor_setAsText_Invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Boolean.TYPE);
+		try {
+			editor.setAsText("***true***");
+			fail("Should throw a IllegalArgumentException");
+		} catch (IllegalArgumentException e) {
+		}
+	}
+
+	public void testByteEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
+		byte b = (byte) 0x7F;
+		editor.setAsText(Byte.toString(b));
+		assertEquals(Byte.toString(b), editor.getAsText());
+		assertEquals("((byte)127)", editor.getJavaInitializationString());
+		assertEquals(new Byte(b), editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testByteEditor_null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testByteEditor_invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
+		try {
+			editor.setAsText("invalid");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testByteEditor_invalid2() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Byte.TYPE);
+		try {
+			editor.setAsText("128");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testDoubleEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Double.TYPE);
+		double d = 12345.678;
+		editor.setAsText(Double.toString(d));
+		assertEquals(Double.toString(d), editor.getAsText());
+		assertEquals(Double.toString(d), editor.getJavaInitializationString());
+		assertEquals(new Double(d), editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testDoubleEditor_SetAsText_Null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Double.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a NullPointerException");
+		} catch (NullPointerException e) {
+
+		}
+	}
+
+	public void testDoubleEditor_SetAsText_Invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Double.TYPE);
+		try {
+			editor.setAsText("invalid");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testFloatEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Float.TYPE);
+		float f = 12345.678f;
+		String text = Float.toString(f);
+		editor.setAsText(text);
+		assertEquals(text, editor.getAsText());
+		assertEquals(text + "F", editor.getJavaInitializationString());
+		assertEquals(new Float(f), editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testFloatEditor_SetAsText_Null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Float.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a NullPointerException");
+		} catch (NullPointerException e) {
+
+		}
+	}
+
+	public void testFloatEditor_SetAsText_Invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Float.TYPE);
+		try {
+			editor.setAsText("invalid");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testLongEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Long.TYPE);
+		long l = 123456789;
+		String text = Long.toString(l);
+		editor.setAsText(text);
+		assertEquals(text, editor.getAsText());
+		assertEquals(text + "L", editor.getJavaInitializationString());
+		assertEquals(new Long(l), editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testLongEditor_SetAsText_Null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Long.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testLongEditor_SetAsText_Invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Long.TYPE);
+		try {
+			editor.setAsText("invalid");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testShortEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Short.TYPE);
+		short s = (short) 123456789;
+		String text = Short.toString(s);
+		editor.setAsText(text);
+		assertEquals(text, editor.getAsText());
+		assertEquals("((short)" + text + ")", editor
+				.getJavaInitializationString());
+		assertEquals(new Short(s), editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testShortEditor_SetAsText_Null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Short.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testShortEditor_SetAsText_Invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Short.TYPE);
+		try {
+			editor.setAsText("invalid");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testIntegerEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
+		int i = 123456789;
+		String text = Integer.toString(i);
+		editor.setAsText(text);
+		assertEquals(text, editor.getAsText());
+		assertEquals(text, editor.getJavaInitializationString());
+		assertEquals(new Integer(i), editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testIntegerEditor_SetAsText_Null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
+		try {
+			editor.setAsText(null);
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testIntegerEditor_SetAsText_Invalid() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(Integer.TYPE);
+		try {
+			editor.setAsText("invalid");
+			fail("Should throw a NumberFormatException");
+		} catch (NumberFormatException e) {
+
+		}
+	}
+
+	public void testStringEditor() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(String.class);
+		String text = "A sample string";
+		editor.setAsText(text);
+		assertEquals(text, editor.getAsText());
+		assertEquals("\"" + text + "\"", editor.getJavaInitializationString());
+		assertEquals(text, editor.getValue());
+		assertNull(editor.getTags());
+	}
+
+	public void testStringEditor_SetAsText_Null() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(String.class);
+
+		editor.setAsText("null");
+		assertEquals("null", editor.getAsText());
+		assertEquals("\"null\"", editor.getJavaInitializationString());
+		assertEquals("null", editor.getValue());
+
+		editor.setAsText("");
+		assertEquals("", editor.getAsText());
+		assertEquals("\"\"", editor.getJavaInitializationString());
+
+		editor.setAsText(null);
+		assertEquals("null", editor.getAsText());
+		assertEquals("null", editor.getJavaInitializationString());
+		assertNull(editor.getValue());
+	}
+
+	public void testStringEditor_SetAsText_SpecialChars() {
+		PropertyEditor editor = PropertyEditorManager.findEditor(String.class);
+		String str = "\n\t\\a\"";
+		editor.setAsText(str);
+		assertEquals(str, editor.getAsText());
+		assertEquals("\"\\n\\u0009\\\\a\\\"\"", editor
+				.getJavaInitializationString());
+	}
+
+	public static class FozRegisteredEditor implements PropertyEditor {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#addPropertyChangeListener(java.beans.PropertyChangeListener)
+		 */
+		public void addPropertyChangeListener(PropertyChangeListener listener) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getAsText()
+		 */
+		public String getAsText() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getCustomEditor()
+		 */
+		public Component getCustomEditor() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getJavaInitializationString()
+		 */
+		public String getJavaInitializationString() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getTags()
+		 */
+		public String[] getTags() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getValue()
+		 */
+		public Object getValue() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#isPaintable()
+		 */
+		public boolean isPaintable() {
+			// TO DO Auto-generated method stub
+			return false;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#paintValue(java.awt.Graphics,
+		 *      java.awt.Rectangle)
+		 */
+		public void paintValue(Graphics graphics, Rectangle box) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#removePropertyChangeListener(java.beans.PropertyChangeListener)
+		 */
+		public void removePropertyChangeListener(PropertyChangeListener listener) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#setAsText(java.lang.String)
+		 */
+		public void setAsText(String text) throws IllegalArgumentException {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#setValue(java.lang.Object)
+		 */
+		public void setValue(Object value) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#supportsCustomEditor()
+		 */
+		public boolean supportsCustomEditor() {
+			// TO DO Auto-generated method stub
+			return false;
+		}
+
+	}
+
+	public static class ButtonEditor implements PropertyEditor {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#addPropertyChangeListener(java.beans.PropertyChangeListener)
+		 */
+		public void addPropertyChangeListener(PropertyChangeListener listener) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getAsText()
+		 */
+		public String getAsText() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getCustomEditor()
+		 */
+		public Component getCustomEditor() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getJavaInitializationString()
+		 */
+		public String getJavaInitializationString() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getTags()
+		 */
+		public String[] getTags() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#getValue()
+		 */
+		public Object getValue() {
+			// TO DO Auto-generated method stub
+			return null;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#isPaintable()
+		 */
+		public boolean isPaintable() {
+			// TO DO Auto-generated method stub
+			return false;
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#paintValue(java.awt.Graphics,
+		 *      java.awt.Rectangle)
+		 */
+		public void paintValue(Graphics graphics, Rectangle box) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#removePropertyChangeListener(java.beans.PropertyChangeListener)
+		 */
+		public void removePropertyChangeListener(PropertyChangeListener listener) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#setAsText(java.lang.String)
+		 */
+		public void setAsText(String text) throws IllegalArgumentException {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#setValue(java.lang.Object)
+		 */
+		public void setValue(Object value) {
+			// TO DO Auto-generated method stub
+
+		}
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.beans.PropertyEditor#supportsCustomEditor()
+		 */
+		public boolean supportsCustomEditor() {
+			// TO DO Auto-generated method stub
+			return false;
+		}
+
+	}
+    
+    
+    /**
+     * The test checks the method findEditor() for registered editors
+     */
+    public void testFindRegisteredEditor() {
+        PropertyEditorManager.registerEditor(SampleProperty.class,
+                OtherEditor.class);
+        PropertyEditor pe = PropertyEditorManager.findEditor(
+                SampleProperty.class);
+        if(pe == null) {
+            fail("No property editor found");
+        } else {
+            assertTrue(pe instanceof OtherEditor);
+        }
+        PropertyEditorManager.registerEditor(SampleProperty.class, null);
+    }
+    
+    /**
+     * The test checks the method findEditor() for editors found by name
+     */
+    public void testFindEditorByNameAddOn() {
+        PropertyEditor pe = PropertyEditorManager.findEditor(
+                SampleProperty.class);
+        if(pe == null) {
+            fail("No property editor found");
+        } else {
+            assertTrue(pe instanceof SamplePropertyEditor);
+        }
+    }
+    
+    /**
+     * The test checks the method findEditor() for editors on search path
+     */
+    public void testFindEditorByDefaultLocation() {
+        PropertyEditorManager.setEditorSearchPath(
+                new String[] {"org.apache.harmony.beans.tests.java.beans.editors"});
+        PropertyEditor pe = PropertyEditorManager.findEditor(
+                AnotherSampleProperty.class);
+        if(pe == null) {
+            fail("No property editor found");
+        } else {
+            assertTrue(pe instanceof AnotherSamplePropertyEditor);
+        }
+    }
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorSupportTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorSupportTest.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/PropertyEditorSupportTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorSupportTest.java Wed Jun  7 20:40:24 2006
@@ -1,396 +1,396 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.beans.tests.java.beans;
-
-import java.beans.EventHandler;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyEditorSupport;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test of PropertyEditorSupport
- */
-public class PropertyEditorSupportTest extends TestCase {
-
-	/*
-	 * Class under test for void PropertyEditorSupport()
-	 */
-	public void testPropertyEditorSupport() {
-        // Regression for HARMONY-516
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-
-		assertEquals("null", support.getAsText());
-		assertNull(support.getValue());
-		assertNull(support.getCustomEditor());
-		assertEquals("???", support.getJavaInitializationString());
-		assertNull(support.getTags());
-		assertFalse(support.supportsCustomEditor());
-		assertFalse(support.isPaintable());
-
-        Object value = new String[] { "java.awt.Color.orange" };
-        support.setValue(value);
-        assertEquals(value.toString(), support.getAsText());
-    }
-
-	/*
-     * Class under test for void PropertyEditorSupport(Object)
-     */
-	public void testPropertyEditorSupportObject() {
-		MockSource source = new MockSource();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport(
-				source);
-
-		assertEquals("null", support.getAsText());
-		assertNull(support.getValue());
-		assertNull(support.getCustomEditor());
-		assertEquals("???", support.getJavaInitializationString());
-		assertNull(support.getTags());
-		assertFalse(support.supportsCustomEditor());
-		assertFalse(support.isPaintable());
-    }
-
-	/*
-     * source null
-     */
-	public void testPropertyEditorSupportObject_null() {
-		try {
-			MockPropertyEditorSupport support = new MockPropertyEditorSupport(
-					null);
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	/*
-	 * public void addPropertyChangeListener(PropertyChangeListener listener)
-	 */
-	public void testAddPropertyChangeListener() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support.addPropertyChangeListener((PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "setCalled"));
-		support.firePropertyChange();
-
-		assertEquals("called", target.getLabel());
-	}
-
-	public void testAddPropertyChangeListener_source() {
-		MockTarget target = new MockTarget();
-		MockSource source = new MockSource();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport(
-				source);
-		support.addPropertyChangeListener((PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "eventSource",
-						"source"));
-		support.firePropertyChange();
-		assertSame(source, target.getEventSource());
-	}
-
-	public void testAddPropertyChangeListener_source_null() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support
-				.addPropertyChangeListener((PropertyChangeListener) EventHandler
-						.create(PropertyChangeListener.class, target,
-								"eventSource", ""));
-		support.firePropertyChange();
-		PropertyChangeEvent event = (PropertyChangeEvent) target
-				.getEventSource();
-
-		assertNull(event.getPropertyName());
-		assertSame(support, event.getSource());
-	}
-
-	public void testFirePropertyChange_noListener() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support.firePropertyChange();
-	}
-
-	/*
-	 * listener is null
-	 */
-	public void testAddPropertyChangeListener_null() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support.addPropertyChangeListener(null);
-		try {
-			support.firePropertyChange();
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-	}
-
-	public void testPaintValue() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support.paintValue(null, null);
-	}
-
-	public void testRemovePropertyChangeListener() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "eventSource",
-						"source");
-		support.addPropertyChangeListener(proxy);
-		support.firePropertyChange();
-		assertSame(support, target.getEventSource());
-
-		target.setEventSource(null);
-		support.removePropertyChangeListener(proxy);
-		support.firePropertyChange();
-		assertNull(target.getEventSource());
-	}
-
-	public void testRemovePropertyChangeListener_null() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "eventSource",
-						"source");
-		support.addPropertyChangeListener(proxy);
-		support.firePropertyChange();
-		assertSame(support, target.getEventSource());
-
-		target.setEventSource(null);
-		support.removePropertyChangeListener(null);
-		support.firePropertyChange();
-		assertSame(support, target.getEventSource());
-	}
-
-	/*
-	 * remove a different listener
-	 */
-	public void testRemovePropertyChangeListener_diff() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "eventSource",
-						"source");
-		support.addPropertyChangeListener(proxy);
-		support.firePropertyChange();
-		assertSame(support, target.getEventSource());
-
-		target.setEventSource(null);
-		PropertyChangeListener proxy2 = (PropertyChangeListener) EventHandler
-				.create(PropertyChangeListener.class, target, "eventSource",
-						"source");
-		support.removePropertyChangeListener(proxy2);
-		support.firePropertyChange();
-		assertSame(support, target.getEventSource());
-	}
-
-	/*
-	 * remove null listener
-	 */
-	public void testRemovePropertyChangeListener_null_null() {
-		MockTarget target = new MockTarget();
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support.addPropertyChangeListener(null);
-		try {
-			support.firePropertyChange();
-			fail("Should throw NullPointerException.");
-		} catch (NullPointerException e) {
-			// expected
-		}
-
-		support.removePropertyChangeListener(null);
-		support.firePropertyChange();
-	}
-
-	public void testSetAsText() {
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		String asText = "100";
-		try {
-			support.setAsText(asText);
-			fail("Should throw IllegalArgumentException.");
-		} catch (IllegalArgumentException e) {
-			// expected
-		}
-	}
-
-	public void testSetValue() {
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		String[] value = new String[] { "This is a sample value." };
-		support.setValue(value);
-
-		assertEquals(value, support.getValue());
-		assertEquals(value.toString(), support.getAsText());
-
-		assertNull(support.getCustomEditor());
-		assertEquals("???", support.getJavaInitializationString());
-		assertNull(support.getTags());
-		assertFalse(support.supportsCustomEditor());
-		assertFalse(support.isPaintable());
-
-	}
-
-	public void testSetValue_null() {
-		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
-		support.setValue(null);
-
-		assertEquals(null, support.getValue());
-		assertEquals("null", support.getAsText());
-
-		assertNull(support.getCustomEditor());
-		assertEquals("???", support.getJavaInitializationString());
-		assertNull(support.getTags());
-		assertFalse(support.supportsCustomEditor());
-		assertFalse(support.isPaintable());
-
-		MockTarget target = new MockTarget();
-		support.setValue(target);
-
-		assertSame(target, support.getValue());
-		assertEquals(target.toString(), support.getAsText());
-		assertNull(support.getCustomEditor());
-		assertEquals("???", support.getJavaInitializationString());
-		assertNull(support.getTags());
-		assertFalse(support.supportsCustomEditor());
-		assertFalse(support.isPaintable());
-	}
-
-	public static class MockPropertyEditorSupport extends PropertyEditorSupport {
-		public MockPropertyEditorSupport() {
-			super();
-		}
-
-		public MockPropertyEditorSupport(Object source) {
-			super(source);
-		}
-	}
-
-	public static class MockSource {
-		String id;
-
-		String text;
-
-		public MockSource() {
-			this.id = "0001";
-			this.text = getClass().getName();
-		}
-
-		/**
-		 * @return Returns the id.
-		 */
-		public String getId() {
-			return id;
-		}
-
-		/**
-		 * @param id
-		 *            The id to set.
-		 */
-		public void setId(String id) {
-			this.id = id;
-		}
-
-		/**
-		 * @return Returns the text.
-		 */
-		public String getText() {
-			return text;
-		}
-
-		/**
-		 * @param text
-		 *            The text to set.
-		 */
-		public void setText(String text) {
-			this.text = text;
-		}
-	}
-
-	public static class MockTarget {
-		String id;
-
-		String label;
-
-		Object eventSource;
-
-		public MockTarget() {
-			this.id = "0001";
-			this.label = getClass().getName();
-		}
-
-		/**
-		 * @return Returns the id.
-		 */
-		public String getId() {
-			return id;
-		}
-
-		/**
-		 * @param id
-		 *            The id to set.
-		 */
-		public void setId(String id) {
-			this.id = id;
-		}
-
-		/**
-		 * @return Returns the text.
-		 */
-		public String getLabel() {
-			return label;
-		}
-
-		/**
-		 * @param text
-		 *            The text to set.
-		 */
-		public void setLabel(String label) {
-			this.label = label;
-		}
-
-		public void setCalled() {
-			this.label = "called";
-		}
-
-		/**
-		 * @return Returns the eventSource.
-		 */
-		public Object getEventSource() {
-			return eventSource;
-		}
-
-		/**
-		 * @param eventSource
-		 *            The eventSource to set.
-		 */
-		public void setEventSource(Object eventSource) {
-			this.eventSource = eventSource;
-		}
-
-		public boolean equals(Object o) {
-			if (!(o instanceof MockTarget)) {
-				return false;
-			}
-
-			MockTarget other = (MockTarget) o;
-			return ((this.id == null ? other.id == null : this.id
-					.equals(other.id))
-					&& (this.eventSource == null ? other.eventSource == null
-							: this.eventSource.equals(other.eventSource)) && (this.label == null ? other.label == null
-					: this.label.equals(other.label)));
-		}
-	}
-}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.beans.tests.java.beans;
+
+import java.beans.EventHandler;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditorSupport;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test of PropertyEditorSupport
+ */
+public class PropertyEditorSupportTest extends TestCase {
+
+	/*
+	 * Class under test for void PropertyEditorSupport()
+	 */
+	public void testPropertyEditorSupport() {
+        // Regression for HARMONY-516
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+
+		assertEquals("null", support.getAsText());
+		assertNull(support.getValue());
+		assertNull(support.getCustomEditor());
+		assertEquals("???", support.getJavaInitializationString());
+		assertNull(support.getTags());
+		assertFalse(support.supportsCustomEditor());
+		assertFalse(support.isPaintable());
+
+        Object value = new String[] { "java.awt.Color.orange" };
+        support.setValue(value);
+        assertEquals(value.toString(), support.getAsText());
+    }
+
+	/*
+     * Class under test for void PropertyEditorSupport(Object)
+     */
+	public void testPropertyEditorSupportObject() {
+		MockSource source = new MockSource();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport(
+				source);
+
+		assertEquals("null", support.getAsText());
+		assertNull(support.getValue());
+		assertNull(support.getCustomEditor());
+		assertEquals("???", support.getJavaInitializationString());
+		assertNull(support.getTags());
+		assertFalse(support.supportsCustomEditor());
+		assertFalse(support.isPaintable());
+    }
+
+	/*
+     * source null
+     */
+	public void testPropertyEditorSupportObject_null() {
+		try {
+			MockPropertyEditorSupport support = new MockPropertyEditorSupport(
+					null);
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+			// expected
+		}
+	}
+
+	/*
+	 * public void addPropertyChangeListener(PropertyChangeListener listener)
+	 */
+	public void testAddPropertyChangeListener() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support.addPropertyChangeListener((PropertyChangeListener) EventHandler
+				.create(PropertyChangeListener.class, target, "setCalled"));
+		support.firePropertyChange();
+
+		assertEquals("called", target.getLabel());
+	}
+
+	public void testAddPropertyChangeListener_source() {
+		MockTarget target = new MockTarget();
+		MockSource source = new MockSource();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport(
+				source);
+		support.addPropertyChangeListener((PropertyChangeListener) EventHandler
+				.create(PropertyChangeListener.class, target, "eventSource",
+						"source"));
+		support.firePropertyChange();
+		assertSame(source, target.getEventSource());
+	}
+
+	public void testAddPropertyChangeListener_source_null() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support
+				.addPropertyChangeListener((PropertyChangeListener) EventHandler
+						.create(PropertyChangeListener.class, target,
+								"eventSource", ""));
+		support.firePropertyChange();
+		PropertyChangeEvent event = (PropertyChangeEvent) target
+				.getEventSource();
+
+		assertNull(event.getPropertyName());
+		assertSame(support, event.getSource());
+	}
+
+	public void testFirePropertyChange_noListener() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support.firePropertyChange();
+	}
+
+	/*
+	 * listener is null
+	 */
+	public void testAddPropertyChangeListener_null() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support.addPropertyChangeListener(null);
+		try {
+			support.firePropertyChange();
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+			// expected
+		}
+	}
+
+	public void testPaintValue() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support.paintValue(null, null);
+	}
+
+	public void testRemovePropertyChangeListener() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
+				.create(PropertyChangeListener.class, target, "eventSource",
+						"source");
+		support.addPropertyChangeListener(proxy);
+		support.firePropertyChange();
+		assertSame(support, target.getEventSource());
+
+		target.setEventSource(null);
+		support.removePropertyChangeListener(proxy);
+		support.firePropertyChange();
+		assertNull(target.getEventSource());
+	}
+
+	public void testRemovePropertyChangeListener_null() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
+				.create(PropertyChangeListener.class, target, "eventSource",
+						"source");
+		support.addPropertyChangeListener(proxy);
+		support.firePropertyChange();
+		assertSame(support, target.getEventSource());
+
+		target.setEventSource(null);
+		support.removePropertyChangeListener(null);
+		support.firePropertyChange();
+		assertSame(support, target.getEventSource());
+	}
+
+	/*
+	 * remove a different listener
+	 */
+	public void testRemovePropertyChangeListener_diff() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		PropertyChangeListener proxy = (PropertyChangeListener) EventHandler
+				.create(PropertyChangeListener.class, target, "eventSource",
+						"source");
+		support.addPropertyChangeListener(proxy);
+		support.firePropertyChange();
+		assertSame(support, target.getEventSource());
+
+		target.setEventSource(null);
+		PropertyChangeListener proxy2 = (PropertyChangeListener) EventHandler
+				.create(PropertyChangeListener.class, target, "eventSource",
+						"source");
+		support.removePropertyChangeListener(proxy2);
+		support.firePropertyChange();
+		assertSame(support, target.getEventSource());
+	}
+
+	/*
+	 * remove null listener
+	 */
+	public void testRemovePropertyChangeListener_null_null() {
+		MockTarget target = new MockTarget();
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support.addPropertyChangeListener(null);
+		try {
+			support.firePropertyChange();
+			fail("Should throw NullPointerException.");
+		} catch (NullPointerException e) {
+			// expected
+		}
+
+		support.removePropertyChangeListener(null);
+		support.firePropertyChange();
+	}
+
+	public void testSetAsText() {
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		String asText = "100";
+		try {
+			support.setAsText(asText);
+			fail("Should throw IllegalArgumentException.");
+		} catch (IllegalArgumentException e) {
+			// expected
+		}
+	}
+
+	public void testSetValue() {
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		String[] value = new String[] { "This is a sample value." };
+		support.setValue(value);
+
+		assertEquals(value, support.getValue());
+		assertEquals(value.toString(), support.getAsText());
+
+		assertNull(support.getCustomEditor());
+		assertEquals("???", support.getJavaInitializationString());
+		assertNull(support.getTags());
+		assertFalse(support.supportsCustomEditor());
+		assertFalse(support.isPaintable());
+
+	}
+
+	public void testSetValue_null() {
+		MockPropertyEditorSupport support = new MockPropertyEditorSupport();
+		support.setValue(null);
+
+		assertEquals(null, support.getValue());
+		assertEquals("null", support.getAsText());
+
+		assertNull(support.getCustomEditor());
+		assertEquals("???", support.getJavaInitializationString());
+		assertNull(support.getTags());
+		assertFalse(support.supportsCustomEditor());
+		assertFalse(support.isPaintable());
+
+		MockTarget target = new MockTarget();
+		support.setValue(target);
+
+		assertSame(target, support.getValue());
+		assertEquals(target.toString(), support.getAsText());
+		assertNull(support.getCustomEditor());
+		assertEquals("???", support.getJavaInitializationString());
+		assertNull(support.getTags());
+		assertFalse(support.supportsCustomEditor());
+		assertFalse(support.isPaintable());
+	}
+
+	public static class MockPropertyEditorSupport extends PropertyEditorSupport {
+		public MockPropertyEditorSupport() {
+			super();
+		}
+
+		public MockPropertyEditorSupport(Object source) {
+			super(source);
+		}
+	}
+
+	public static class MockSource {
+		String id;
+
+		String text;
+
+		public MockSource() {
+			this.id = "0001";
+			this.text = getClass().getName();
+		}
+
+		/**
+		 * @return Returns the id.
+		 */
+		public String getId() {
+			return id;
+		}
+
+		/**
+		 * @param id
+		 *            The id to set.
+		 */
+		public void setId(String id) {
+			this.id = id;
+		}
+
+		/**
+		 * @return Returns the text.
+		 */
+		public String getText() {
+			return text;
+		}
+
+		/**
+		 * @param text
+		 *            The text to set.
+		 */
+		public void setText(String text) {
+			this.text = text;
+		}
+	}
+
+	public static class MockTarget {
+		String id;
+
+		String label;
+
+		Object eventSource;
+
+		public MockTarget() {
+			this.id = "0001";
+			this.label = getClass().getName();
+		}
+
+		/**
+		 * @return Returns the id.
+		 */
+		public String getId() {
+			return id;
+		}
+
+		/**
+		 * @param id
+		 *            The id to set.
+		 */
+		public void setId(String id) {
+			this.id = id;
+		}
+
+		/**
+		 * @return Returns the text.
+		 */
+		public String getLabel() {
+			return label;
+		}
+
+		/**
+		 * @param text
+		 *            The text to set.
+		 */
+		public void setLabel(String label) {
+			this.label = label;
+		}
+
+		public void setCalled() {
+			this.label = "called";
+		}
+
+		/**
+		 * @return Returns the eventSource.
+		 */
+		public Object getEventSource() {
+			return eventSource;
+		}
+
+		/**
+		 * @param eventSource
+		 *            The eventSource to set.
+		 */
+		public void setEventSource(Object eventSource) {
+			this.eventSource = eventSource;
+		}
+
+		public boolean equals(Object o) {
+			if (!(o instanceof MockTarget)) {
+				return false;
+			}
+
+			MockTarget other = (MockTarget) o;
+			return ((this.id == null ? other.id == null : this.id
+					.equals(other.id))
+					&& (this.eventSource == null ? other.eventSource == null
+							: this.eventSource.equals(other.eventSource)) && (this.label == null ? other.label == null
+					: this.label.equals(other.label)));
+		}
+	}
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorTest.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/PropertyEditorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyEditorTest.java Wed Jun  7 20:40:24 2006
@@ -1,83 +1,83 @@
-/* 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.awt.Component;
-import java.awt.Graphics;
-import java.awt.Rectangle;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyEditor;
-
-import org.apache.harmony.beans.tests.java.beans.PropertyChangeListenerTest.DummyPropertyChangeListener;
-
-import junit.framework.TestCase;
-
-/**
- * Test the signature of the interface PropertyEditor.
- */
-public class PropertyEditorTest extends TestCase {
-
-	public void testSignature() {
-		DummyPropertyEditor o = new DummyPropertyEditor();
-		assertTrue(o instanceof PropertyEditor);
-	}
-
-	static class DummyPropertyEditor implements PropertyEditor {
-
-		public void addPropertyChangeListener(PropertyChangeListener listener) {
-		}
-
-		public String getAsText() {
-			return null;
-		}
-
-		public Component getCustomEditor() {
-			return null;
-		}
-
-		public String getJavaInitializationString() {
-			return null;
-		}
-
-		public String[] getTags() {
-			return null;
-		}
-
-		public Object getValue() {
-			return null;
-		}
-
-		public boolean isPaintable() {
-			return false;
-		}
-
-		public void paintValue(Graphics graphics, Rectangle box) {
-		}
-
-		public void removePropertyChangeListener(PropertyChangeListener listener) {
-		}
-
-		public void setAsText(String text) throws IllegalArgumentException {
-		}
-
-		public void setValue(Object value) {
-		}
-
-		public boolean supportsCustomEditor() {
-			return false;
-		}
-	}
-}
+/* 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.awt.Component;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyEditor;
+
+import org.apache.harmony.beans.tests.java.beans.PropertyChangeListenerTest.DummyPropertyChangeListener;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the signature of the interface PropertyEditor.
+ */
+public class PropertyEditorTest extends TestCase {
+
+	public void testSignature() {
+		DummyPropertyEditor o = new DummyPropertyEditor();
+		assertTrue(o instanceof PropertyEditor);
+	}
+
+	static class DummyPropertyEditor implements PropertyEditor {
+
+		public void addPropertyChangeListener(PropertyChangeListener listener) {
+		}
+
+		public String getAsText() {
+			return null;
+		}
+
+		public Component getCustomEditor() {
+			return null;
+		}
+
+		public String getJavaInitializationString() {
+			return null;
+		}
+
+		public String[] getTags() {
+			return null;
+		}
+
+		public Object getValue() {
+			return null;
+		}
+
+		public boolean isPaintable() {
+			return false;
+		}
+
+		public void paintValue(Graphics graphics, Rectangle box) {
+		}
+
+		public void removePropertyChangeListener(PropertyChangeListener listener) {
+		}
+
+		public void setAsText(String text) throws IllegalArgumentException {
+		}
+
+		public void setValue(Object value) {
+		}
+
+		public boolean supportsCustomEditor() {
+			return false;
+		}
+	}
+}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.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/PropertyVetoExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyVetoExceptionTest.java Wed Jun  7 20:40:24 2006
@@ -1,118 +1,118 @@
-/* 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.Beans;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyVetoException;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-import tests.util.SerializationTester;
-
-/**
- * Unit test for class PropertyVetoException
- */
-public class PropertyVetoExceptionTest extends TestCase {
-
-	private PropertyChangeEvent event;
-
-	protected void setUp() throws Exception {
-		super.setUp();
-		MockJavaBean myBean = new MockJavaBean("Bean_PropertyVetoExceptionTest");
-		event = new PropertyChangeEvent(myBean, "propertyOne", "value_old",
-				"value_one");
-	}
-
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	public void testPropertyVetoException() {
-		String message = "testPropertyVetoException";
-		PropertyVetoException e = new PropertyVetoException(message, event);
-		assertSame(message, e.getMessage());
-		assertSame(event, e.getPropertyChangeEvent());
-	}
-
-	public void testPropertyVetoException_MessageNull() {
-		String message = null;
-		PropertyVetoException e = new PropertyVetoException(message, event);
-		assertNull(e.getMessage());
-		assertSame(event, e.getPropertyChangeEvent());
-	}
-
-	public void testPropertyVetoException_EventNull() {
-		String message = "testPropertyVetoException";
-		PropertyVetoException e = new PropertyVetoException(message, null);
-		assertSame(message, e.getMessage());
-		assertNull(e.getPropertyChangeEvent());
-	}
-
-	public void testSerializablization() throws IOException,
-			ClassNotFoundException {
-		String message = "testPropertyVetoException";
-		PropertyVetoException e = new PropertyVetoException(message, event);
-		assertSame(message, e.getMessage());
-		assertSame(event, e.getPropertyChangeEvent());
-
-		PropertyVetoException deserializedException = (PropertyVetoException) SerializationTester
-				.getDeserilizedObject(e);
-
-		assertEquals(message, deserializedException.getMessage());
-		assertEquals(event.getNewValue(), deserializedException
-				.getPropertyChangeEvent().getNewValue());
-		assertEquals(event.getOldValue(), deserializedException
-				.getPropertyChangeEvent().getOldValue());
-		assertEquals(event.getPropertyName(), deserializedException
-				.getPropertyChangeEvent().getPropertyName());
-		assertEquals(event.getPropagationId(), deserializedException
-				.getPropertyChangeEvent().getPropagationId());
-		assertNull(deserializedException.getPropertyChangeEvent().getSource());
-	}
-
-	public void testSerializablization_Compatibility() throws Exception {
-		String message = "testPropertyVetoException";
-		PropertyVetoException e = new PropertyVetoException(message, event);
-		assertSame(message, e.getMessage());
-		assertSame(event, e.getPropertyChangeEvent());
-
-		PropertyVetoException deserializedException = (PropertyVetoException) SerializationTester
-				.readObject(e, "serialization/java/beans/PropertyVetoException.ser");
-
-		assertEquals(message, deserializedException.getMessage());
-		assertEquals(event.getNewValue(), deserializedException
-				.getPropertyChangeEvent().getNewValue());
-		assertEquals(event.getOldValue(), deserializedException
-				.getPropertyChangeEvent().getOldValue());
-		assertEquals(event.getPropertyName(), deserializedException
-				.getPropertyChangeEvent().getPropertyName());
-		assertEquals(event.getPropagationId(), deserializedException
-				.getPropertyChangeEvent().getPropagationId());
-		assertNull(deserializedException.getPropertyChangeEvent().getSource());
-	}
-    
-    public void testPropertyVetoExceptionMessage() {
-        // Regression for HARMONY-235 (tracking the similar bug)
-        PropertyChangeEvent event = new PropertyChangeEvent(new Beans(),
-                "propertyName", "oldValue", "newValue");
-
-        String message = "test message";
-
-        PropertyVetoException e = new PropertyVetoException(message, event);
-        assertEquals(message, e.getMessage());
-    }
-}
+/* 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.Beans;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyVetoException;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+import tests.util.SerializationTester;
+
+/**
+ * Unit test for class PropertyVetoException
+ */
+public class PropertyVetoExceptionTest extends TestCase {
+
+	private PropertyChangeEvent event;
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		MockJavaBean myBean = new MockJavaBean("Bean_PropertyVetoExceptionTest");
+		event = new PropertyChangeEvent(myBean, "propertyOne", "value_old",
+				"value_one");
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	public void testPropertyVetoException() {
+		String message = "testPropertyVetoException";
+		PropertyVetoException e = new PropertyVetoException(message, event);
+		assertSame(message, e.getMessage());
+		assertSame(event, e.getPropertyChangeEvent());
+	}
+
+	public void testPropertyVetoException_MessageNull() {
+		String message = null;
+		PropertyVetoException e = new PropertyVetoException(message, event);
+		assertNull(e.getMessage());
+		assertSame(event, e.getPropertyChangeEvent());
+	}
+
+	public void testPropertyVetoException_EventNull() {
+		String message = "testPropertyVetoException";
+		PropertyVetoException e = new PropertyVetoException(message, null);
+		assertSame(message, e.getMessage());
+		assertNull(e.getPropertyChangeEvent());
+	}
+
+	public void testSerializablization() throws IOException,
+			ClassNotFoundException {
+		String message = "testPropertyVetoException";
+		PropertyVetoException e = new PropertyVetoException(message, event);
+		assertSame(message, e.getMessage());
+		assertSame(event, e.getPropertyChangeEvent());
+
+		PropertyVetoException deserializedException = (PropertyVetoException) SerializationTester
+				.getDeserilizedObject(e);
+
+		assertEquals(message, deserializedException.getMessage());
+		assertEquals(event.getNewValue(), deserializedException
+				.getPropertyChangeEvent().getNewValue());
+		assertEquals(event.getOldValue(), deserializedException
+				.getPropertyChangeEvent().getOldValue());
+		assertEquals(event.getPropertyName(), deserializedException
+				.getPropertyChangeEvent().getPropertyName());
+		assertEquals(event.getPropagationId(), deserializedException
+				.getPropertyChangeEvent().getPropagationId());
+		assertNull(deserializedException.getPropertyChangeEvent().getSource());
+	}
+
+	public void testSerializablization_Compatibility() throws Exception {
+		String message = "testPropertyVetoException";
+		PropertyVetoException e = new PropertyVetoException(message, event);
+		assertSame(message, e.getMessage());
+		assertSame(event, e.getPropertyChangeEvent());
+
+		PropertyVetoException deserializedException = (PropertyVetoException) SerializationTester
+				.readObject(e, "serialization/java/beans/PropertyVetoException.ser");
+
+		assertEquals(message, deserializedException.getMessage());
+		assertEquals(event.getNewValue(), deserializedException
+				.getPropertyChangeEvent().getNewValue());
+		assertEquals(event.getOldValue(), deserializedException
+				.getPropertyChangeEvent().getOldValue());
+		assertEquals(event.getPropertyName(), deserializedException
+				.getPropertyChangeEvent().getPropertyName());
+		assertEquals(event.getPropagationId(), deserializedException
+				.getPropertyChangeEvent().getPropagationId());
+		assertNull(deserializedException.getPropertyChangeEvent().getSource());
+	}
+    
+    public void testPropertyVetoExceptionMessage() {
+        // Regression for HARMONY-235 (tracking the similar bug)
+        PropertyChangeEvent event = new PropertyChangeEvent(new Beans(),
+                "propertyName", "oldValue", "newValue");
+
+        String message = "test message";
+
+        PropertyVetoException e = new PropertyVetoException(message, event);
+        assertEquals(message, e.getMessage());
+    }
+}



Mime
View raw message