Examples of MockButton


Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * Class under test for Object create(Class, Object, String)
     */
    public void testCreateClassObjectString() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "setCalled");
        button.addPropertyChangeListener(proxy);
        button.setLabel("new label value");
        assertTrue(Proxy.isProxyClass(proxy.getClass()));
        assertTrue(target.isCalled());
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * the target's method is null
     */
    public void testCreateClassObjectString_MethodNull() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        try {
            PropertyChangeListener proxy = EventHandler.create(
                    PropertyChangeListener.class, target, null);
            fail("Should throw NullPointerException.");
        } catch (NullPointerException e) {
        }
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "");
        button.addPropertyChangeListener(proxy);
        try {
            button.setLabel("new label value");
            fail("Should throw RuntimeException.");
        } catch (RuntimeException e) {
        }
        assertTrue(Proxy.isProxyClass(proxy.getClass()));
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * the target's method is invalid
     */
    public void testCreateClassObjectString_MethodEmpty() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "");
        button.addPropertyChangeListener(proxy);
        try {
            button.setLabel("new label value");
            fail("Should throw RuntimeException.");
        } catch (RuntimeException e) {
        }
        assertTrue(Proxy.isProxyClass(proxy.getClass()));
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * Class under test for Object create(Class, Object, String, String)
     */
    public void testCreateClassObjectStringString() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "text", "source.label");
        assertTrue(Proxy.isProxyClass(proxy.getClass()));

        button.addPropertyChangeListener(proxy);
        String newLabel = "New Value: set text.";
        button.setLabel(newLabel);
        assertEquals(MockButton.defaultName, target.getText());
        button.setLabel("New Value: set text2.");
        assertEquals(newLabel, target.getText());
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * the action is null
     */
    public void testCreateClassObjectStringString_ActionNull() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        try {
            PropertyChangeListener proxy = EventHandler.create(
                    PropertyChangeListener.class, target, null, "source.label");
            fail("should throw NPE");
        } catch (NullPointerException e) {
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * action is invalid
     */
    public void testCreateClassObjectStringString_ActionInvalid() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "action_invalid",
                "source.label");
        assertTrue(Proxy.isProxyClass(proxy.getClass()));

        button.addPropertyChangeListener(proxy);
        String newLabel = "New Value: set text.";
        try {
            button.setLabel(newLabel);
            fail("Should throw RuntimeException.");
        } catch (RuntimeException e) {
        }
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * propertyname is null
     */
    public void testCreateClassObjectStringString_PropertyNameNull() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "text", null);
        assertTrue(Proxy.isProxyClass(proxy.getClass()));

        button.addPropertyChangeListener(proxy);
        String newLabel = "New Value: set text.";
        try {
            button.setLabel(newLabel);
            fail("Should throw NullPointerException.");
        } catch (Exception e) {
        }
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * property name is invalid
     */
    public void testCreateClassObjectStringString_PropertyNameInvalid() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "text",
                "source.label_invalid");

        assertTrue(Proxy.isProxyClass(proxy.getClass()));

        button.addPropertyChangeListener(proxy);
        String newLabel = "New Value: set text.";

        try {
            button.setLabel(newLabel);
            fail("Should throw NullPointerException.");
        } catch (RuntimeException e) {
        }
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * Class under test for Object create(Class, Object, String, String, String)
     */
    public void testCreateClassObjectStringStringString() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        PropertyChangeListener proxy = EventHandler.create(
                PropertyChangeListener.class, target, "text", "source.label",
                "propertyChange");
        assertTrue(Proxy.isProxyClass(proxy.getClass()));

        button.addPropertyChangeListener(proxy);
        String newLabel = "New Value: set text.";
        button.setLabel(newLabel);
        assertEquals(MockButton.defaultName, target.getText());
        button.setLabel("New Value: set text2.");
        assertEquals(newLabel, target.getText());
    }
View Full Code Here

Examples of org.apache.harmony.beans.tests.support.mock.MockButton

    /*
     * action is null
     */
    public void testCreateClassObjectStringStringString_ActionNull() {
        MockTarget target = new MockTarget();
        MockButton button = new MockButton();
        try {
            PropertyChangeListener proxy = EventHandler.create(
                    PropertyChangeListener.class, target, null, "source.label",
                    "propertyChange");
            fail("should throw NPE");
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.