Index: trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java =================================================================== --- trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java (revision 448441) +++ trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventSetDescriptorTest.java (working copy) @@ -144,8 +144,8 @@ try { new EventSetDescriptor(sourceClass, "", listenerType, listenerMethodName); - fail("Should throw StringIndexOutOfBoundsException."); } catch (StringIndexOutOfBoundsException e) { + fail("Should not throw StringIndexOutOfBoundsException."); } } @@ -341,7 +341,7 @@ public void testEventSetDescriptorClassStringClassStringArrayStringString_eventNull() throws IntrospectionException { Class sourceClass = MockSourceClass.class; - String eventSetName = null; + String eventSetName = "MockPropertyChange"; Class listenerType = MockPropertyChangeListener.class; String[] listenerMethodNames = { "mockPropertyChange", "mockPropertyChange2", }; @@ -368,6 +368,16 @@ assertEquals(listenerType, esd.getListenerType()); assertTrue(esd.isInDefaultEventSet()); assertFalse(esd.isUnicast()); + //Regression for HARMONY-1504 + try { + new EventSetDescriptor(sourceClass, + null, listenerType, listenerMethodNames, addMethod, + removeMethod); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + //expected + } + } /* @@ -585,7 +595,7 @@ assertEquals(addMethod, esd.getAddListenerMethod().getName()); assertEquals(removeMethod, esd.getRemoveListenerMethod().getName()); - assertEquals(getMethod, esd.getGetListenerMethod().getName()); + assertNull(esd.getGetListenerMethod()); assertEquals(2, esd.getListenerMethods().length); assertEquals(listenerMethodNames[0], esd.getListenerMethods()[0] @@ -629,6 +639,16 @@ eventSetName, listenerType, listenerMethodNames, addMethod, removeMethod, getMethod); assertNull(esd.getGetListenerMethod()); + + //Regression for Harmony-1504 + try { + new EventSetDescriptor(sourceClass, + eventSetName, listenerType, null, addMethod, + removeMethod, getMethod); + fail("NullPointerException expected"); + } catch (NullPointerException e) { + //expected + } } /* @@ -647,7 +667,7 @@ EventSetDescriptor esd = new EventSetDescriptor(sourceClass, eventSetName, listenerType, listenerMethodNames, addMethod, removeMethod, getMethod); - assertEquals(addMethod, esd.getGetListenerMethod().getName()); + assertNull(esd.getGetListenerMethod()); } /* Index: trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java =================================================================== --- trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java (revision 448441) +++ trunk/modules/beans/src/test/support/java/org/apache/harmony/beans/tests/support/OtherBean.java (working copy) @@ -27,7 +27,7 @@ public class OtherBean { - public void addSaampleListener(SampleListener listener) { + public void addSampleListener(SampleListener listener) { } public void removeSampleListener(SampleListener listener) {