Examples of EventSetDescriptor


Examples of java.beans.EventSetDescriptor

        String eventSetName = "mockPropertyChange";
        String listenerMethodName = eventSetName;
        Class<?> sourceClass = null;
        Class<?> listenerType = MockPropertyChangeListener.class;
        try {
            new EventSetDescriptor(sourceClass, eventSetName, listenerType,
                    listenerMethodName);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

        String eventSetName = "mockPropertyChange";
        String listenerMethodName = eventSetName;
        Class<MockSourceClass> sourceClass = MockSourceClass.class;
        Class<?> listenerType = MockPropertyChangeListener.class;
        try {
            new EventSetDescriptor(sourceClass, null, listenerType,
                    listenerMethodName);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

        try {
            // RI doesn't throw exception here but this doesn't really make
            // much sense. Moreover, it is against the java.beans
            // package description: null values or empty Strings are not
            // valid parameters unless explicitly stated
            new EventSetDescriptor(sourceClass, "", listenerType,
                    listenerMethodName);
        } catch (IntrospectionException e) {
            // valid
        }
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

            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());
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

            SecurityException, NoSuchMethodException {
        String eventSetName = "mockPropertyChange";
        String listenerMethodName = eventSetName;
        Class<MockSourceClass> sourceClass = MockSourceClass.class;
        Class<?> listenerType = org.apache.harmony.beans.tests.support.mock.MockPropertyChangeListener2.class;
        EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
                eventSetName, listenerType, listenerMethodName);

        String listenerName = getUnQualifiedClassName(listenerType);
        Method addMethod = sourceClass.getMethod("add" + listenerName,
                new Class[] { listenerType });
        Method removeMethod = sourceClass.getMethod("remove" + listenerName,
                new Class[] { listenerType });

        assertEquals(addMethod, esd.getAddListenerMethod());
        assertEquals(removeMethod, esd.getRemoveListenerMethod());
        assertNull(esd.getGetListenerMethod());
        assertEquals(1, esd.getListenerMethods().length);
        assertEquals(listenerMethodName, esd.getListenerMethods()[0].getName());
        assertEquals(1, esd.getListenerMethodDescriptors().length);
        assertEquals(listenerMethodName, esd.getListenerMethodDescriptors()[0]
                .getMethod().getName());

        assertEquals(listenerType, esd.getListenerType());
        assertTrue(esd.isInDefaultEventSet());
        assertFalse(esd.isUnicast());
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

        String eventSetName = "mockPropertyChange";
        String listenerMethodName = eventSetName;
        Class<MockSourceClass> sourceClass = MockSourceClass.class;
        Class<?> listenerType = null;
        try {
            new EventSetDescriptor(sourceClass, eventSetName, listenerType,
                    listenerMethodName);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

            NoSuchMethodException {
        String eventSetName = "MockPropertyChange";
        String listenerMethodName = "mockPropertyChange";
        Class<MockSourceClass> sourceClass = MockSourceClass.class;
        Class<?> listenerType = MockFakeListener.class;
        EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
                eventSetName, listenerType, listenerMethodName);
        String listenerName = getUnQualifiedClassName(listenerType);
        Method addMethod = sourceClass.getMethod("add" + listenerName,
                new Class[] { listenerType });
        Method removeMethod = sourceClass.getMethod("remove" + listenerName,
                new Class[] { listenerType });

        assertEquals(addMethod, esd.getAddListenerMethod());
        assertEquals(removeMethod, esd.getRemoveListenerMethod());
        assertNull(esd.getGetListenerMethod());
        assertEquals(1, esd.getListenerMethods().length);
        assertEquals(listenerMethodName, esd.getListenerMethods()[0].getName());
        assertEquals(1, esd.getListenerMethodDescriptors().length);
        assertEquals(listenerMethodName, esd.getListenerMethodDescriptors()[0]
                .getMethod().getName());

        assertEquals(listenerType, esd.getListenerType());
        assertTrue(esd.isInDefaultEventSet());
        assertFalse(esd.isUnicast());
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

        String eventSetName = "mockPropertyChange";
        String listenerMethodName = null;
        Class<MockSourceClass> sourceClass = MockSourceClass.class;
        Class<?> listenerType = MockPropertyChangeListener.class;
        try {
            new EventSetDescriptor(sourceClass, eventSetName, listenerType,
                    listenerMethodName);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
            // expected
        }
View Full Code Here

Examples of java.beans.EventSetDescriptor

        String eventSetName = "mockPropertyChange";
        String listenerMethodName = "";
        Class<MockSourceClass> sourceClass = MockSourceClass.class;
        Class<?> listenerType = MockPropertyChangeListener.class;
        try {
            new EventSetDescriptor(sourceClass, eventSetName, listenerType,
                    listenerMethodName);
            fail("Should throw IntrospectionException.");
        } catch (IntrospectionException e) {
        }
    }
View Full Code Here

Examples of java.beans.EventSetDescriptor

        String[] listenerMethodNames = { "mockPropertyChange",
                "mockPropertyChange2", };
        String addMethod = "addMockPropertyChangeListener";
        String removeMethod = "removeMockPropertyChangeListener";

        EventSetDescriptor esd = new EventSetDescriptor(sourceClass,
                eventSetName, listenerType, listenerMethodNames, addMethod,
                removeMethod);

        assertEquals(addMethod, esd.getAddListenerMethod().getName());
        assertEquals(removeMethod, esd.getRemoveListenerMethod().getName());
        assertNull(esd.getGetListenerMethod());
        assertEquals(2, esd.getListenerMethods().length);
        assertEquals(listenerMethodNames[0], esd.getListenerMethods()[0]
                .getName());
        assertEquals(listenerMethodNames[1], esd.getListenerMethods()[1]
                .getName());
        assertEquals(MockPropertyChangeEvent.class, esd.getListenerMethods()[1]
                .getParameterTypes()[0]);       
        assertEquals(2, esd.getListenerMethodDescriptors().length);
        assertEquals(listenerMethodNames[0],
                esd.getListenerMethodDescriptors()[0].getMethod().getName());
        assertEquals(listenerMethodNames[1],
                esd.getListenerMethodDescriptors()[1].getMethod().getName());

        assertEquals(listenerType, esd.getListenerType());
        assertTrue(esd.isInDefaultEventSet());
        assertFalse(esd.isUnicast());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.