You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/10/03 13:06:03 UTC
svn commit: r452415 [5/12] - in
/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test:
java-internal/java/beans/beancontext/ java-internal/org/apache/harmony/beans/
java/org/apache/harmony/beans/tests/
java/org/apache/harmony/beans/tests/ja...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ExpressionTest.java Tue Oct 3 04:05:57 2006
@@ -117,8 +117,8 @@
assertSame(arg3, t.getArguments()[2]);
assertSame(arg4, t.getArguments()[3]);
- assertEquals("<unbound>=ExpressionTest$MockParent.method(" +
- "\"string1\", Object, \"string3\", Integer);", t.toString());
+ assertEquals("<unbound>=ExpressionTest$MockParent.method("
+ + "\"string1\", Object, \"string3\", Integer);", t.toString());
}
/*
@@ -143,14 +143,14 @@
Object arg = new Object();
Object[] oa = new Object[] { arg };
Expression t = new Expression(target, "method", oa);
-
+
assertSame(target, t.getTarget());
assertSame("method", t.getMethodName());
assertSame(oa, t.getArguments());
assertSame(arg, t.getArguments()[0]);
-
- assertEquals("<unbound>=ExpressionTest$MockParent.method(Object);",
- t.toString());
+
+ assertEquals("<unbound>=ExpressionTest$MockParent.method(Object);", t
+ .toString());
}
/*
@@ -178,8 +178,7 @@
assertSame("new", t.getMethodName());
assertSame(oa, t.getArguments());
- assertEquals("<unbound>=Class.new(Object);",
- t.toString());
+ assertEquals("<unbound>=Class.new(Object);", t.toString());
}
/*
@@ -206,8 +205,8 @@
assertSame("method", t.getMethodName());
assertEquals(0, t.getArguments().length);
- assertEquals("<unbound>=ExpressionTest$MockParent.method();",
- t.toString());
+ assertEquals("<unbound>=ExpressionTest$MockParent.method();", t
+ .toString());
}
/*
@@ -223,8 +222,8 @@
assertSame(oa, t.getArguments());
assertNull(t.getArguments()[0]);
- assertEquals("<unbound>=ExpressionTest$MockParent.method(null);",
- t.toString());
+ assertEquals("<unbound>=ExpressionTest$MockParent.method(null);", t
+ .toString());
}
/*
@@ -248,9 +247,9 @@
assertSame(arg2, t.getArguments()[1]);
assertSame(arg3, t.getArguments()[2]);
assertSame(arg4, t.getArguments()[3]);
-
- assertEquals("Object=ExpressionTest$MockParent.method(" +
- "\"mama\", Object, Object, Long);", t.toString());
+
+ assertEquals("Object=ExpressionTest$MockParent.method("
+ + "\"mama\", Object, Object, Long);", t.toString());
}
/*
@@ -276,7 +275,7 @@
*/
public void testConstructor_Value_ArrayTarget() throws Exception {
Integer val = new Integer(69);
- Object target = new Integer[] { val };
+ Object target = new Integer[] { val };
Object arg = new Integer(0);
Object[] oa = new Object[] { arg };
Expression t = new Expression(val, target, "get", oa);
@@ -837,30 +836,29 @@
*
* Note: decided by definition position! should be ambiguous.
*/
-// public void testGetValue_EqualSpecificMethods() throws Exception {
-// MockObject mo = new MockObject(false);
-// Object[] arguments = new Object[] { new MockObject(false),
-// new MockObject(false) };
-// Expression t = new Expression(mo, "equalSpecificMethod", arguments);
-// assertEquals("equalSpecificMethod1", t.getValue());
-// MockObject.assertCalled("equalSpecificMethod1", arguments);
-// }
-
+ // public void testGetValue_EqualSpecificMethods() throws Exception {
+ // MockObject mo = new MockObject(false);
+ // Object[] arguments = new Object[] { new MockObject(false),
+ // new MockObject(false) };
+ // Expression t = new Expression(mo, "equalSpecificMethod", arguments);
+ // assertEquals("equalSpecificMethod1", t.getValue());
+ // MockObject.assertCalled("equalSpecificMethod1", arguments);
+ // }
/*
* Test the method getValue() with two equal specific methods but one
* declaring thrown exception.
*
* Note: decided by definition position! should call the one with exception.
*/
-// public void testGetValue_EqualSpecificMethodsException() throws Exception {
-// MockObject mo = new MockObject(false);
-// Object[] arguments = new Object[] { new MockObject(false),
-// new MockObject(false), new Object() };
-// Expression t = new Expression(mo, "equalSpecificMethod", arguments);
-// assertEquals("equalSpecificMethod3", t.getValue());
-// MockObject.assertCalled("equalSpecificMethod3", arguments);
-// }
-
+ // public void testGetValue_EqualSpecificMethodsException() throws Exception
+ // {
+ // MockObject mo = new MockObject(false);
+ // Object[] arguments = new Object[] { new MockObject(false),
+ // new MockObject(false), new Object() };
+ // Expression t = new Expression(mo, "equalSpecificMethod", arguments);
+ // assertEquals("equalSpecificMethod3", t.getValue());
+ // MockObject.assertCalled("equalSpecificMethod3", arguments);
+ // }
/*
* Super class of MockObject.
*/
@@ -971,12 +969,12 @@
throw new NullPointerException();
}
-// public Object methodB(Integer i) {
-// reset();
-// calledMethod = "methodB1";
-// receivedArguments.add(i);
-// return calledMethod;
-// }
+ // public Object methodB(Integer i) {
+ // reset();
+ // calledMethod = "methodB1";
+ // receivedArguments.add(i);
+ // return calledMethod;
+ // }
public Object methodB(int i) {
reset();
@@ -1019,40 +1017,42 @@
return calledMethod;
}
-// public Object equalSpecificMethod(MockObject o, MockParent p) {
-// reset();
-// calledMethod = "equalSpecificMethod1";
-// receivedArguments.add(o);
-// receivedArguments.add(p);
-// return calledMethod;
-// }
-
-// public Object equalSpecificMethod(MockParent p, MockObject o) {
-// reset();
-// calledMethod = "equalSpecificMethod2";
-// receivedArguments.add(p);
-// receivedArguments.add(o);
-// return calledMethod;
-// }
-
-// public Object equalSpecificMethod(MockObject o, MockParent p, Object o2) {
-// reset();
-// calledMethod = "equalSpecificMethod3";
-// receivedArguments.add(o);
-// receivedArguments.add(p);
-// receivedArguments.add(o2);
-// return calledMethod;
-// }
-
-// public Object equalSpecificMethod(MockParent p, MockObject o, Object o2)
-// throws Exception {
-// reset();
-// calledMethod = "equalSpecificMethod4";
-// receivedArguments.add(p);
-// receivedArguments.add(o);
-// receivedArguments.add(o2);
-// return calledMethod;
-// }
+ // public Object equalSpecificMethod(MockObject o, MockParent p) {
+ // reset();
+ // calledMethod = "equalSpecificMethod1";
+ // receivedArguments.add(o);
+ // receivedArguments.add(p);
+ // return calledMethod;
+ // }
+
+ // public Object equalSpecificMethod(MockParent p, MockObject o) {
+ // reset();
+ // calledMethod = "equalSpecificMethod2";
+ // receivedArguments.add(p);
+ // receivedArguments.add(o);
+ // return calledMethod;
+ // }
+
+ // public Object equalSpecificMethod(MockObject o, MockParent p, Object
+ // o2) {
+ // reset();
+ // calledMethod = "equalSpecificMethod3";
+ // receivedArguments.add(o);
+ // receivedArguments.add(p);
+ // receivedArguments.add(o2);
+ // return calledMethod;
+ // }
+
+ // public Object equalSpecificMethod(MockParent p, MockObject o, Object
+ // o2)
+ // throws Exception {
+ // reset();
+ // calledMethod = "equalSpecificMethod4";
+ // receivedArguments.add(p);
+ // receivedArguments.add(o);
+ // receivedArguments.add(o2);
+ // return calledMethod;
+ // }
public static Class forName(String o) {
reset();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FeatureDescriptorTest.java Tue Oct 3 04:05:57 2006
@@ -28,254 +28,255 @@
*/
public class FeatureDescriptorTest extends TestCase {
- private FeatureDescriptor fd;
+ private FeatureDescriptor fd;
- protected void setUp() throws Exception {
- super.setUp();
- fd = new FeatureDescriptor();
- }
-
- public void testFeatureDescriptor() {
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetDisplayName() {
- String displayName = "FeatureDescriptor.displayName";
- fd.setDisplayName(displayName);
- assertSame(displayName, fd.getDisplayName());
- assertNull(fd.getName());
- assertSame(displayName, fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetDisplayName_DisplayNameNull() {
- String displayName = null;
- fd.setDisplayName(displayName);
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetExpert_False() {
- fd.setExpert(false);
- assertFalse(fd.isExpert());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetExpert_True() {
- fd.setExpert(true);
- assertTrue(fd.isExpert());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetHidden_False() {
- fd.setHidden(false);
- assertFalse(fd.isHidden());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetHidden_True() {
- fd.setHidden(true);
- assertTrue(fd.isHidden());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetName() {
- String name = "FeatureDescriptor.name";
- fd.setName(name);
- assertSame(name, fd.getName());
-
- assertSame(name, fd.getDisplayName());
- assertSame(name, fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetName_null() {
- fd.setName("FeatureDescriptor.name");
- fd.setName(null);
- assertNull(fd.getName());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetPreferred_False() {
- fd.setPreferred(false);
- assertFalse(fd.isPreferred());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- }
-
- public void testSetPreferred_True() {
- fd.setPreferred(true);
- assertTrue(fd.isPreferred());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
- assertNull(fd.getShortDescription());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- }
-
- public void testSetShortDescription() {
- String shortDesc = "FeatureDescriptor.ShortDescription";
- fd.setShortDescription(shortDesc);
- assertSame(shortDesc, fd.getShortDescription());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetShortDescription_ShortDescNull() {
- String shortDesc = "FeatureDescriptor.ShortDescription";
- fd.setShortDescription(shortDesc);
- assertSame(shortDesc, fd.getShortDescription());
- fd.setShortDescription(null);
- assertNull(fd.getShortDescription());
-
- assertNull(fd.getDisplayName());
- assertNull(fd.getName());
-
- assertNotNull(fd.attributeNames());
-
- assertFalse(fd.isExpert());
- assertFalse(fd.isHidden());
- assertFalse(fd.isPreferred());
- }
-
- public void testSetValue() {
- String[] attributeNames = { "Blue", "Yellow", "Red", };
- Object[] values = { "Blue.value", "Yellow.value", "Red.value", };
- for (int i = 0; i < attributeNames.length; i++) {
- fd.setValue(attributeNames[i], values[i]);
- }
-
- for (int i = 0; i < attributeNames.length; i++) {
- assertSame(values[i], fd.getValue(attributeNames[i]));
- }
- }
-
- public void testSetValue_ExistAttribute() {
- String attributeName = "blue";
- Object value = "Anyone";
- fd.setValue(attributeName, value);
- assertSame(value, fd.getValue(attributeName));
-
- Object newValue = "Another";
- fd.setValue(attributeName, newValue);
- assertSame(newValue, fd.getValue(attributeName));
- }
-
- public void testSetValue_ValueNull() {
- String attributeName = "blue";
- Object value = "Anyone";
- fd.setValue(attributeName, value);
- assertSame(value, fd.getValue(attributeName));
-
- Object newValue = null;
- try {
- fd.setValue(attributeName, newValue);
- fail("Should throw NullPointerException.");
- } catch (NullPointerException e) {
- }
- }
-
- public void testattributeNames() {
- assertFalse(fd.attributeNames().hasMoreElements());
-
- String[] attributeNames = { "Blue", "Yellow", "Red", };
- Object[] values = { "Blue.value", "Yellow.value", "Red.value", };
- for (int i = 0; i < attributeNames.length; i++) {
- fd.setValue(attributeNames[i], values[i]);
- }
- Enumeration<String> names = fd.attributeNames();
- Hashtable<String, Object> table = new Hashtable<String, Object>();
- while (names.hasMoreElements()) {
- String name = names.nextElement();
- table.put(name, fd.getValue(name));
- }
-
- assertEquals(attributeNames.length, table.size());
- for (int i = 0; i < attributeNames.length; i++) {
- assertTrue(table.containsKey(attributeNames[i]));
- }
- }
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ fd = new FeatureDescriptor();
+ }
+
+ public void testFeatureDescriptor() {
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetDisplayName() {
+ String displayName = "FeatureDescriptor.displayName";
+ fd.setDisplayName(displayName);
+ assertSame(displayName, fd.getDisplayName());
+ assertNull(fd.getName());
+ assertSame(displayName, fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetDisplayName_DisplayNameNull() {
+ String displayName = null;
+ fd.setDisplayName(displayName);
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetExpert_False() {
+ fd.setExpert(false);
+ assertFalse(fd.isExpert());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetExpert_True() {
+ fd.setExpert(true);
+ assertTrue(fd.isExpert());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetHidden_False() {
+ fd.setHidden(false);
+ assertFalse(fd.isHidden());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetHidden_True() {
+ fd.setHidden(true);
+ assertTrue(fd.isHidden());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetName() {
+ String name = "FeatureDescriptor.name";
+ fd.setName(name);
+ assertSame(name, fd.getName());
+
+ assertSame(name, fd.getDisplayName());
+ assertSame(name, fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetName_null() {
+ fd.setName("FeatureDescriptor.name");
+ fd.setName(null);
+ assertNull(fd.getName());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetPreferred_False() {
+ fd.setPreferred(false);
+ assertFalse(fd.isPreferred());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ }
+
+ public void testSetPreferred_True() {
+ fd.setPreferred(true);
+ assertTrue(fd.isPreferred());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+ assertNull(fd.getShortDescription());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ }
+
+ public void testSetShortDescription() {
+ String shortDesc = "FeatureDescriptor.ShortDescription";
+ fd.setShortDescription(shortDesc);
+ assertSame(shortDesc, fd.getShortDescription());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetShortDescription_ShortDescNull() {
+ String shortDesc = "FeatureDescriptor.ShortDescription";
+ fd.setShortDescription(shortDesc);
+ assertSame(shortDesc, fd.getShortDescription());
+ fd.setShortDescription(null);
+ assertNull(fd.getShortDescription());
+
+ assertNull(fd.getDisplayName());
+ assertNull(fd.getName());
+
+ assertNotNull(fd.attributeNames());
+
+ assertFalse(fd.isExpert());
+ assertFalse(fd.isHidden());
+ assertFalse(fd.isPreferred());
+ }
+
+ public void testSetValue() {
+ String[] attributeNames = { "Blue", "Yellow", "Red", };
+ Object[] values = { "Blue.value", "Yellow.value", "Red.value", };
+ for (int i = 0; i < attributeNames.length; i++) {
+ fd.setValue(attributeNames[i], values[i]);
+ }
+
+ for (int i = 0; i < attributeNames.length; i++) {
+ assertSame(values[i], fd.getValue(attributeNames[i]));
+ }
+ }
+
+ public void testSetValue_ExistAttribute() {
+ String attributeName = "blue";
+ Object value = "Anyone";
+ fd.setValue(attributeName, value);
+ assertSame(value, fd.getValue(attributeName));
+
+ Object newValue = "Another";
+ fd.setValue(attributeName, newValue);
+ assertSame(newValue, fd.getValue(attributeName));
+ }
+
+ public void testSetValue_ValueNull() {
+ String attributeName = "blue";
+ Object value = "Anyone";
+ fd.setValue(attributeName, value);
+ assertSame(value, fd.getValue(attributeName));
+
+ Object newValue = null;
+ try {
+ fd.setValue(attributeName, newValue);
+ fail("Should throw NullPointerException.");
+ } catch (NullPointerException e) {
+ }
+ }
+
+ public void testattributeNames() {
+ assertFalse(fd.attributeNames().hasMoreElements());
+
+ String[] attributeNames = { "Blue", "Yellow", "Red", };
+ Object[] values = { "Blue.value", "Yellow.value", "Red.value", };
+ for (int i = 0; i < attributeNames.length; i++) {
+ fd.setValue(attributeNames[i], values[i]);
+ }
+ Enumeration<String> names = fd.attributeNames();
+ Hashtable<String, Object> table = new Hashtable<String, Object>();
+ while (names.hasMoreElements()) {
+ String name = names.nextElement();
+ table.put(name, fd.getValue(name));
+ }
+
+ assertEquals(attributeNames.length, table.size());
+ for (String element : attributeNames) {
+ assertTrue(table.containsKey(element));
+ }
+ }
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FozzzEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FozzzEditor.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FozzzEditor.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/FozzzEditor.java Tue Oct 3 04:05:57 2006
@@ -28,7 +28,9 @@
*/
public class FozzzEditor implements PropertyEditor {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#addPropertyChangeListener(java.beans.PropertyChangeListener)
*/
public void addPropertyChangeListener(PropertyChangeListener listener) {
@@ -36,7 +38,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#getAsText()
*/
public String getAsText() {
@@ -44,7 +48,9 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#getCustomEditor()
*/
public Component getCustomEditor() {
@@ -52,7 +58,9 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#getJavaInitializationString()
*/
public String getJavaInitializationString() {
@@ -60,7 +68,9 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#getTags()
*/
public String[] getTags() {
@@ -68,7 +78,9 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#getValue()
*/
public Object getValue() {
@@ -76,7 +88,9 @@
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#isPaintable()
*/
public boolean isPaintable() {
@@ -84,15 +98,20 @@
return false;
}
- /* (non-Javadoc)
- * @see java.beans.PropertyEditor#paintValue(java.awt.Graphics, java.awt.Rectangle)
+ /*
+ * (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)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#removePropertyChangeListener(java.beans.PropertyChangeListener)
*/
public void removePropertyChangeListener(PropertyChangeListener listener) {
@@ -100,7 +119,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#setAsText(java.lang.String)
*/
public void setAsText(String text) throws IllegalArgumentException {
@@ -108,7 +129,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#setValue(java.lang.Object)
*/
public void setValue(Object value) {
@@ -116,7 +139,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.beans.PropertyEditor#supportsCustomEditor()
*/
public boolean supportsCustomEditor() {
@@ -125,5 +150,3 @@
}
}
-
-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IndexedPropertyDescriptorTest.java Tue Oct 3 04:05:57 2006
@@ -21,10 +21,10 @@
import java.beans.IntrospectionException;
import java.lang.reflect.Method;
-import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
-
import junit.framework.TestCase;
+import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
+
/**
* Unit test for IndexedPropertyDescriptor.
*/
@@ -351,12 +351,12 @@
assertFalse(ipd.isHidden());
assertFalse(ipd.isPreferred());
- //Regression for HARMONY-1236
+ // Regression for HARMONY-1236
try {
new IndexedPropertyDescriptor("0xDFRF", Float.TYPE);
fail("IntrospectionException expected");
} catch (IntrospectionException e) {
- //expected
+ // expected
}
}
@@ -367,7 +367,8 @@
try {
new IndexedPropertyDescriptor(propertyName, beanClass);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClass_PropertyNameEmpty()
@@ -377,7 +378,8 @@
try {
new IndexedPropertyDescriptor(propertyName, beanClass);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClass_PropertyNameInvalid()
@@ -387,7 +389,8 @@
try {
new IndexedPropertyDescriptor(propertyName, beanClass);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClass_NotIndexedProperty()
@@ -397,7 +400,8 @@
try {
new IndexedPropertyDescriptor(propertyName, beanClass);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClass_ClassNull()
@@ -407,7 +411,8 @@
try {
new IndexedPropertyDescriptor(propertyName, beanClass);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/*
@@ -478,7 +483,8 @@
"get" + propertyName, "set" + propertyName, "get"
+ propertyName, "set" + propertyName);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClassStringStringStringString_propEmpty() {
@@ -489,7 +495,8 @@
"set" + propertyName, "get" + propertyName, "set"
+ propertyName);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClassStringStringStringString_propInvalid()
@@ -515,7 +522,8 @@
+ propertyName, "set" + propertyName, "get" + propertyName,
"set" + propertyName);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringClassStringStringStringString_ReadMethodNull()
@@ -595,7 +603,8 @@
new IndexedPropertyDescriptor(propertyName, beanClass, "get"
+ propertyName, "set" + propertyName, null, null);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/**
@@ -766,7 +775,8 @@
new IndexedPropertyDescriptor(null, readMethod, writeMethod,
indexedReadMethod, indexedWriteMethod);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/*
@@ -790,7 +800,8 @@
new IndexedPropertyDescriptor("", readMethod, writeMethod,
indexedReadMethod, indexedWriteMethod);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testIndexedPropertyDescriptorStringMethodMethodMethodMethod_propInvalid()
@@ -913,7 +924,8 @@
new IndexedPropertyDescriptor(propertyName, readMethod,
writeMethod, null, null);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
@@ -1083,7 +1095,8 @@
try {
ipd.setIndexedReadMethod(readMethod);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/*
@@ -1111,7 +1124,8 @@
try {
ipd.setIndexedReadMethod(writeMethod);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/*
@@ -1141,7 +1155,8 @@
try {
ipd.setIndexedReadMethod(voidMethod);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testSetIndexedWriteMethod_null() throws IntrospectionException,
@@ -1209,7 +1224,8 @@
try {
ipd.setIndexedWriteMethod(indexedReadMethod);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/*
@@ -1236,7 +1252,8 @@
try {
ipd.setIndexedWriteMethod(badArgType);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
public void testSetIndexedWriteMethod_return()
@@ -1285,7 +1302,8 @@
try {
ipd.setIndexedWriteMethod(badArgType);
fail("Should throw IntrospectionException");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
class NotJavaBean {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectionExceptionTest.java Tue Oct 3 04:05:57 2006
@@ -57,7 +57,7 @@
SerializationTest.verifyGolden(this, new IntrospectionException(
"IntrospectionExceptionTest"));
}
-
+
public void testIntrospectionExceptionMessage() {
// Regression for HARMONY-235
IntrospectionException e = new IntrospectionException("test message");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/IntrospectorTest.java Tue Oct 3 04:05:57 2006
@@ -82,7 +82,8 @@
try {
Class.forName("java.beans.Introspector").newInstance();
fail("No exception is thrown on new Introspector() call");
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
}
/**
@@ -130,23 +131,23 @@
assertNotNull(info);
EventSetDescriptor[] descriptors = info.getEventSetDescriptors();
assertNotNull(descriptors);
- for (int i = 0; i < descriptors.length; ++i) {
- Method m = descriptors[i].getAddListenerMethod();
+ for (EventSetDescriptor element : descriptors) {
+ Method m = element.getAddListenerMethod();
if (m != null) {
Class[] exceptionTypes = m.getExceptionTypes();
boolean found = false;
- for (int j = 0; j < exceptionTypes.length; ++j) {
- if (exceptionTypes[j]
+ for (Class element0 : exceptionTypes) {
+ if (element0
.equals(TooManyListenersException.class)) {
- assertTrue(descriptors[i].isUnicast());
+ assertTrue(element.isUnicast());
found = true;
break;
}
}
if (!found) {
- assertFalse(descriptors[i].isUnicast());
+ assertFalse(element.isUnicast());
}
}
}
@@ -213,18 +214,21 @@
try {
Introspector.getBeanInfo((java.lang.Class) null);
fail("getBeanInfo should throw NullPointerException");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
Introspector.getBeanInfo((java.lang.Class) null,
(java.lang.Class) null);
fail("getBeanInfo should throw NullPointerException");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
try {
Introspector.getBeanInfo((java.lang.Class) null, 0);
fail("getBeanInfo should throw NullPointerException");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
}
/**
@@ -324,7 +328,8 @@
try {
Introspector.flushFromCaches(null);
fail("Should throw NullPointerException.");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
}
/*
@@ -347,20 +352,20 @@
assertEquals(methods.length, methodDesc.length);
ArrayList methodList = new ArrayList();
- for (int i = 0; i < methods.length; i++) {
- methodList.add(methods[i]);
+ for (Method element : methods) {
+ methodList.add(element);
}
- for (int i = 0; i < methodDesc.length; i++) {
- assertTrue(methodList.contains(methodDesc[i].getMethod()));
+ for (MethodDescriptor element : methodDesc) {
+ assertTrue(methodList.contains(element.getMethod()));
}
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(1, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
@@ -391,7 +396,8 @@
try {
Introspector.getBeanInfo(null);
fail("Should throw NullPointerException.");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
}
/*
@@ -414,8 +420,8 @@
MethodDescriptor[] mds = info.getMethodDescriptors();
assertEquals(2, mds.length);
- for (int i = 0; i < mds.length; i++) {
- assertTrue(mds[i].getName().endsWith("Name"));
+ for (MethodDescriptor element : mds) {
+ assertTrue(element.getName().endsWith("Name"));
}
}
@@ -425,11 +431,11 @@
PropertyDescriptor[] pds = info.getPropertyDescriptors();
boolean name = false;
boolean label = false;
- for (int i = 0; i < pds.length; i++) {
- if (pds[i].getName().equals("name")) {
+ for (PropertyDescriptor element : pds) {
+ if (element.getName().equals("name")) {
name = true;
}
- if (pds[i].getName().equals("label")) {
+ if (element.getName().equals("label")) {
label = true;
}
}
@@ -443,7 +449,8 @@
try {
Introspector.getBeanInfo(null, MockFooStop.class);
fail("Should throw NullPointerException.");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
}
/*
@@ -454,7 +461,8 @@
try {
Introspector.getBeanInfo(MockButton.class, MockFooStop.class);
fail("Should throw IntrospectionException.");
- } catch (IntrospectionException e) {}
+ } catch (IntrospectionException e) {
+ }
}
/*
@@ -466,8 +474,8 @@
Introspector.USE_ALL_BEANINFO);
PropertyDescriptor[] pds = info.getPropertyDescriptors();
int parentProperty = 0;
- for (int i = 0; i < pds.length; i++) {
- String name = pds[i].getName();
+ for (PropertyDescriptor element : pds) {
+ String name = element.getName();
if (name.startsWith("text")) {
parentProperty++;
assertEquals("text.MockFooSubBeanInfo", name);
@@ -483,8 +491,8 @@
MethodDescriptor[] mds = info.getMethodDescriptors();
int parentMethodGet = 0;
int parentMethodSet = 0;
- for (int i = 0; i < mds.length; i++) {
- String name = mds[i].getName();
+ for (MethodDescriptor element : mds) {
+ String name = element.getName();
if (name.startsWith("getText")) {
parentMethodGet++;
assertEquals("getText.MockFooSubBeanInfo", name);
@@ -505,8 +513,8 @@
Introspector.USE_ALL_BEANINFO);
EventSetDescriptor[] esds = info.getEventSetDescriptors();
assertEquals(1, esds.length);
- for (int i = 0; i < esds.length; i++) {
- String name = esds[i].getName();
+ for (EventSetDescriptor element : esds) {
+ String name = element.getName();
assertEquals("mockPropertyChange.MockFooSubBeanInfo", name);
}
}
@@ -520,8 +528,8 @@
Introspector.IGNORE_IMMEDIATE_BEANINFO);
PropertyDescriptor[] pds = info.getPropertyDescriptors();
int fromParent = 0;
- for (int i = 0; i < pds.length; i++) {
- String name = pds[i].getName();
+ for (PropertyDescriptor element : pds) {
+ String name = element.getName();
if (name.startsWith("childName")) {
fromParent++;
assertEquals("childName.MockFooChildBeanInfo", name);
@@ -540,8 +548,8 @@
MethodDescriptor[] mds = info.getMethodDescriptors();
int parentMethodGet = 0;
int parentMethodSet = 0;
- for (int i = 0; i < mds.length; i++) {
- String name = mds[i].getName();
+ for (MethodDescriptor element : mds) {
+ String name = element.getName();
if (name.startsWith("getChildName")) {
parentMethodGet++;
assertEquals("getChildName.MockFooChildBeanInfo", name);
@@ -565,8 +573,8 @@
Introspector.IGNORE_IMMEDIATE_BEANINFO);
EventSetDescriptor[] esds = info.getEventSetDescriptors();
assertEquals(1, esds.length);
- for (int i = 0; i < esds.length; i++) {
- String name = esds[i].getName();
+ for (EventSetDescriptor element : esds) {
+ String name = element.getName();
assertEquals("mockPropertyChange.MockFooChildBeanInfo", name);
}
}
@@ -580,8 +588,8 @@
Introspector.IGNORE_ALL_BEANINFO);
PropertyDescriptor[] pds = info.getPropertyDescriptors();
int text = 0;
- for (int i = 0; i < pds.length; i++) {
- String name = pds[i].getName();
+ for (PropertyDescriptor element : pds) {
+ String name = element.getName();
if (name.startsWith("text")) {
text++;
assertEquals("text", name);
@@ -600,8 +608,8 @@
MethodDescriptor[] mds = info.getMethodDescriptors();
int getMethod = 0;
int setMethod = 0;
- for (int i = 0; i < mds.length; i++) {
- String name = mds[i].getName();
+ for (MethodDescriptor element : mds) {
+ String name = element.getName();
if (name.startsWith("getText")) {
getMethod++;
assertEquals("getText", name);
@@ -669,8 +677,8 @@
BeanInfo info = Introspector.getBeanInfo(MockFooLabel.class);
PropertyDescriptor[] pds = info.getPropertyDescriptors();
- for (int i = 0; i < pds.length; i++) {
- String name = pds[i].getName();
+ for (PropertyDescriptor element : pds) {
+ String name = element.getName();
assertEquals(name, "text.MockFooLabelBeanInfo");
}
@@ -694,15 +702,15 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- assertEquals("fox101", propertyDesc[i].getName());
- assertEquals("setFox101", propertyDesc[i].getWriteMethod()
+ assertEquals("fox101", element.getName());
+ assertEquals("setFox101", element.getWriteMethod()
.getName());
- assertEquals("getFox101", propertyDesc[i].getReadMethod()
+ assertEquals("getFox101", element.getReadMethod()
.getName());
}
}
@@ -722,16 +730,16 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- assertEquals("fox201", propertyDesc[i].getName());
- assertEquals(String.class.getName(), propertyDesc[i]
+ assertEquals("fox201", element.getName());
+ assertEquals(String.class.getName(), element
.getPropertyType().getName());
- assertNotNull(propertyDesc[i].getWriteMethod().getName());
- assertNotNull(propertyDesc[i].getReadMethod().getName());
+ assertNotNull(element.getWriteMethod().getName());
+ assertNotNull(element.getReadMethod().getName());
}
}
}
@@ -750,16 +758,16 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- assertEquals("fox201", propertyDesc[i].getName());
- assertEquals(Integer.class.getName(), propertyDesc[i]
+ assertEquals("fox201", element.getName());
+ assertEquals(Integer.class.getName(), element
.getPropertyType().getName());
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -778,16 +786,16 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- assertEquals("fox301", propertyDesc[i].getName());
- assertEquals(Integer.class.getName(), propertyDesc[i]
+ assertEquals("fox301", element.getName());
+ assertEquals(Integer.class.getName(), element
.getPropertyType().getName());
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -804,19 +812,19 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) propertyDesc[i];
- assertEquals("fox401", propertyDesc[i].getName());
- assertEquals(String[].class.getName(), propertyDesc[i]
+ IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
+ assertEquals("fox401", element.getName());
+ assertEquals(String[].class.getName(), element
.getPropertyType().getName());
assertEquals(String.class.getName(), indexedDesc
.getIndexedPropertyType().getName());
- assertNotNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ assertNotNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
assertNotNull(indexedDesc.getIndexedReadMethod());
assertNotNull(indexedDesc.getIndexedWriteMethod());
}
@@ -835,16 +843,16 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- assertEquals("fox401", propertyDesc[i].getName());
- assertEquals(Integer[].class.getName(), propertyDesc[i]
+ assertEquals("fox401", element.getName());
+ assertEquals(Integer[].class.getName(), element
.getPropertyType().getName());
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -862,17 +870,17 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) propertyDesc[i];
- assertEquals("fox501", propertyDesc[i].getName());
- assertEquals(String[].class.getName(), propertyDesc[i]
+ IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
+ assertEquals("fox501", element.getName());
+ assertEquals(String[].class.getName(), element
.getPropertyType().getName());
- assertNotNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ assertNotNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
assertNotNull(indexedDesc.getIndexedReadMethod());
assertNull(indexedDesc.getIndexedWriteMethod());
assertEquals(String.class.getName(), indexedDesc
@@ -894,17 +902,17 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) propertyDesc[i];
- assertEquals("fox501", propertyDesc[i].getName());
- assertEquals(String[].class.getName(), propertyDesc[i]
+ IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
+ assertEquals("fox501", element.getName());
+ assertEquals(String[].class.getName(), element
.getPropertyType().getName());
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
assertNull(indexedDesc.getIndexedReadMethod());
assertNotNull(indexedDesc.getIndexedWriteMethod());
assertEquals(String.class.getName(), indexedDesc
@@ -926,16 +934,16 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
} else {
- IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) propertyDesc[i];
- assertEquals("fox501", propertyDesc[i].getName());
- assertNull(propertyDesc[i].getPropertyType());
- assertNull(propertyDesc[i].getWriteMethod());
- assertNull(propertyDesc[i].getReadMethod());
+ IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
+ assertEquals("fox501", element.getName());
+ assertNull(element.getPropertyType());
+ assertNull(element.getWriteMethod());
+ assertNull(element.getReadMethod());
assertNull(indexedDesc.getIndexedReadMethod());
assertNotNull(indexedDesc.getIndexedWriteMethod());
assertEquals(Integer.class.getName(), indexedDesc
@@ -962,10 +970,10 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(1, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -989,10 +997,10 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -1010,10 +1018,10 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(1, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -1037,10 +1045,10 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(1, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -1073,10 +1081,10 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("class")) {
- assertNull(propertyDesc[i].getWriteMethod());
- assertNotNull(propertyDesc[i].getReadMethod());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("class")) {
+ assertNull(element.getWriteMethod());
+ assertNotNull(element.getReadMethod());
}
}
}
@@ -1097,9 +1105,9 @@
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(1, propertyDesc.length);
- for (int i = 0; i < propertyDesc.length; i++) {
- if (propertyDesc[i].getName().equals("fox02")) {
- assertEquals("fox02.beaninfo", propertyDesc[i].getDisplayName());
+ for (PropertyDescriptor element : propertyDesc) {
+ if (element.getName().equals("fox02")) {
+ assertEquals("fox02.beaninfo", element.getDisplayName());
}
}
}
@@ -1263,9 +1271,11 @@
try {
Introspector.getBeanInfoSearchPath();
fail("Should throw NullPointerException.");
- } catch (NullPointerException e) {}
+ } catch (NullPointerException e) {
+ }
}
- } catch (SecurityException e) {}
+ } catch (SecurityException e) {
+ }
} finally {
try {
System.setSecurityManager(dfl);
@@ -1303,7 +1313,8 @@
} finally {
try {
System.setSecurityManager(dfl);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ }
}
}
@@ -1340,7 +1351,8 @@
}
}
- public static class Bean3BeanInfo extends SimpleBeanInfo {}
+ public static class Bean3BeanInfo extends SimpleBeanInfo {
+ }
/*
*
@@ -1454,7 +1466,8 @@
static class FakeFox101 extends FakeFox10 {
- public void setFox101(String value) {}
+ public void setFox101(String value) {
+ }
public String getFox101() {
return null;
@@ -1463,7 +1476,8 @@
static class FakeFox20 {
- public void setFox201(String value) {}
+ public void setFox201(String value) {
+ }
}
static class FakeFox201 extends FakeFox20 {
@@ -1489,7 +1503,8 @@
static class FakeFox301 extends FakeFox30 {
- public void setFox301(String value) {}
+ public void setFox301(String value) {
+ }
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/MethodDescriptorTest.java Tue Oct 3 04:05:57 2006
@@ -21,10 +21,10 @@
import java.beans.ParameterDescriptor;
import java.lang.reflect.Method;
-import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
-
import junit.framework.TestCase;
+import org.apache.harmony.beans.tests.support.mock.MockJavaBean;
+
/**
* Unit test for MethodDescriptor
*/
@@ -33,6 +33,7 @@
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
@@ -40,6 +41,7 @@
/*
* @see TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
@@ -51,12 +53,13 @@
NoSuchMethodException {
String beanName = "MethodDescriptorTest.bean";
MockJavaBean bean = new MockJavaBean(beanName);
- Method method = bean.getClass().getMethod("getBeanName", (Class[])null);
+ Method method = bean.getClass()
+ .getMethod("getBeanName", (Class[]) null);
MethodDescriptor md = new MethodDescriptor(method);
assertSame(method, md.getMethod());
assertNull(md.getParameterDescriptors());
-
+
assertEquals(method.getName(), md.getDisplayName());
assertEquals(method.getName(), md.getName());
assertEquals(method.getName(), md.getShortDescription());
@@ -140,7 +143,7 @@
assertFalse(md.isHidden());
assertFalse(md.isPreferred());
}
-
+
/**
* @tests java.beans.MethodDescriptor#MethodDescriptor(
* java.lang.reflect.Method)
@@ -156,8 +159,7 @@
/**
* @tests java.beans.MethodDescriptor#MethodDescriptor(
- * java.lang.reflect.Method,
- * java.beans.ParameterDescriptor[])
+ * java.lang.reflect.Method, java.beans.ParameterDescriptor[])
*/
public void test_Ctor2_NullPointerExpection() {
try {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java?view=diff&rev=452415&r1=452414&r2=452415
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ParameterDescriptorTest.java Tue Oct 3 04:05:57 2006
@@ -26,17 +26,17 @@
*/
public class ParameterDescriptorTest extends TestCase {
- public void testParameterDescriptor() {
- ParameterDescriptor pd = new ParameterDescriptor();
- assertNull(pd.getDisplayName());
- assertNull(pd.getName());
- assertNull(pd.getShortDescription());
+ public void testParameterDescriptor() {
+ ParameterDescriptor pd = new ParameterDescriptor();
+ assertNull(pd.getDisplayName());
+ assertNull(pd.getName());
+ assertNull(pd.getShortDescription());
- assertNotNull(pd.attributeNames());
+ assertNotNull(pd.attributeNames());
- assertFalse(pd.isExpert());
- assertFalse(pd.isHidden());
- assertFalse(pd.isPreferred());
- }
+ assertFalse(pd.isExpert());
+ assertFalse(pd.isHidden());
+ assertFalse(pd.isPreferred());
+ }
}