use of java.beans.EventSetDescriptor in project j2objc by google.
the class EventSetDescriptorTest method testEventSetDescriptorStringClassMethodArrayMethodMethod_removeListenerMethodInvalid.
/*
* removeListenerMethod is invalid
*/
public void testEventSetDescriptorStringClassMethodArrayMethodMethod_removeListenerMethodInvalid() throws IntrospectionException, NoSuchMethodException {
String eventSetName = "MockPropertyChange";
Class<?> listenerType = MockPropertyChangeListener.class;
Method[] listenerMethods = new Method[] { listenerType.getMethod("mockPropertyChange", new Class[] { MockPropertyChangeEvent.class }), listenerType.getMethod("mockPropertyChange2", new Class[] { MockPropertyChangeEvent.class }) };
Class<MockSourceClass> sourceClass = MockSourceClass.class;
Method addMethod = sourceClass.getMethod("addMockPropertyChangeListener", new Class[] { listenerType });
Method removeMethod = sourceClass.getMethod("addMockPropertyChangeListener_Invalid", (Class[]) null);
EventSetDescriptor esd = new EventSetDescriptor(eventSetName, listenerType, listenerMethods, addMethod, removeMethod);
assertEquals(removeMethod, esd.getRemoveListenerMethod());
}
use of java.beans.EventSetDescriptor in project j2objc by google.
the class EventSetDescriptorTest method testEventSetDescriptorStringClassMethodArrayMethodMethodMethod.
/*
* Class under test for void EventSetDescriptor(String, Class, Method[],
* Method, Method, Method)
*/
public void testEventSetDescriptorStringClassMethodArrayMethodMethodMethod() throws SecurityException, NoSuchMethodException, IntrospectionException {
String eventSetName = "MockPropertyChange";
Class<?> listenerType = MockPropertyChangeListener.class;
Method[] listenerMethods = new Method[] { listenerType.getMethod("mockPropertyChange", new Class[] { MockPropertyChangeEvent.class }), listenerType.getMethod("mockPropertyChange2", new Class[] { MockPropertyChangeEvent.class }) };
Class<MockSourceClass> sourceClass = MockSourceClass.class;
Method addMethod = sourceClass.getMethod("addMockPropertyChangeListener", new Class[] { listenerType });
Method removeMethod = sourceClass.getMethod("removeMockPropertyChangeListener", new Class[] { listenerType });
Method getMethod = sourceClass.getMethod("getMockPropertyChangeListener", new Class[] { listenerType });
EventSetDescriptor esd = new EventSetDescriptor(eventSetName, listenerType, listenerMethods, addMethod, removeMethod, getMethod);
assertEquals(getMethod, esd.getGetListenerMethod());
}
use of java.beans.EventSetDescriptor in project j2objc by google.
the class EventSetDescriptorTest method testEventSetDescriptorClassStringClassString_EventInvalid.
/*
* Event is not a subclass of java.util.EventObject.
*/
public void testEventSetDescriptorClassStringClassString_EventInvalid() throws IntrospectionException {
String eventSetName = "MockFake";
String listenerMethodName = "mockNotAEventObject";
Class<MockSourceClass> sourceClass = MockSourceClass.class;
Class<?> listenerType = MockPropertyChangeListener.class;
EventSetDescriptor esd = new EventSetDescriptor(sourceClass, eventSetName, listenerType, listenerMethodName);
assertEquals(listenerMethodName, esd.getListenerMethods()[0].getName());
}
use of java.beans.EventSetDescriptor in project j2objc by google.
the class IntrospectorTest method testIllegalEventSetDescriptor.
/**
* The test checks the getEventSetDescriptors method
*
* @throws IntrospectionException
*/
public void testIllegalEventSetDescriptor() throws IntrospectionException {
BeanInfo info = Introspector.getBeanInfo(MisprintBean.class);
assertNotNull(info);
EventSetDescriptor[] descriptors = info.getEventSetDescriptors();
assertNotNull(descriptors);
assertEquals(0, descriptors.length);
}
use of java.beans.EventSetDescriptor in project j2objc by google.
the class IntrospectorTest method testEventSetDescriptorWithoutAddListenerMethod.
/**
* The test checks the getEventSetDescriptors method
*
* @throws IntrospectionException
*/
public void testEventSetDescriptorWithoutAddListenerMethod() throws IntrospectionException {
BeanInfo info = Introspector.getBeanInfo(OtherBean.class);
EventSetDescriptor[] descriptors;
assertNotNull(info);
descriptors = info.getEventSetDescriptors();
assertNotNull(descriptors);
assertEquals(1, descriptors.length);
assertTrue(contains("sample", descriptors));
}
Aggregations