Package java.beans

Examples of java.beans.Statement.execute()


        Statement t = new Statement(Class.class, "forName", arguments);
        t.execute();

        t = new Statement(String.class, "forName",
                new Object[] { "java.lang.String" });
        t.execute();
    }

    /*
     * Test the method execute() with a normal array object, the method name
     * "get" and valid and invalid arguments.
View Full Code Here


     */
    public void testExecute_ArrayGet() throws Exception {
        Object[] array = new Object[] { "test" };
        Statement t = new Statement(array, "get",
                new Object[] { new Integer(0) });
        t.execute();

        array = new Object[] { "test" };
        t = new Statement(array, "get", new Object[0]);
        try {
            t.execute();
View Full Code Here

        t.execute();

        array = new Object[] { "test" };
        t = new Statement(array, "get", new Object[0]);
        try {
            t.execute();
            fail("Should throw ArrayIndexOutOfBoundsException!");
        } catch (ArrayIndexOutOfBoundsException ex) {
            // expected
        }
    }
View Full Code Here

     */
    public void testExecute_ArraySet() throws Exception {
        Object[] array = new Object[] { "test" };
        Statement t = new Statement(array, "set", new Object[] {
                new Integer(0), "test2" });
        t.execute();
        assertEquals("test2", array[0]);
    }

    /*
     * Test the method execute() with a normal array object, the method name
View Full Code Here

    public void testExecute_ArrayNullIndex() throws Exception {
        Object[] array = new Object[] { "test" };
        Statement t = new Statement(array, "set",
                new Object[] { null, "test2" });
        try {
            t.execute();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
    }
View Full Code Here

     */
    public void testExecute_ArrayInvalidSet() throws Exception {
        Object[] array = new Object[] { "test" };
        Statement t = new Statement(array, "set", new Object[] {
                new Integer(0), "test2" });
        t.execute();
        assertEquals("test2", array[0]);

        try {
            t = new Statement(array, "set", new Object[] { "testtest", "test2",
                    new Object() });
View Full Code Here

            // expected
        }

        t = new Statement(array, "set", new Object[] { new Integer(0) });
        try {
            t.execute();
            fail("Should throw ArrayIndexOutOfBoundsException!");
        } catch (ArrayIndexOutOfBoundsException ex) {
            // expected
        }
    }
View Full Code Here

    public void testExecute_ArrayInvalidSetInt() throws Exception {
        int[] array = new int[] { 1 };
        Statement t = new Statement(array, "getInt",
                new Object[] { new Integer(0) });
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

    public void testExecute_ArrayInvalidName() throws Exception {
        Object[] array = new Object[] { "test" };
        Statement t = new Statement(array, "gets", new Object[] {
                new Integer(0), new Object() });
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

     */
    public void testExecute_PrimitiveVSWrapper() throws Exception {
        MockObject mo = new MockObject(false);
        Object[] arguments = new Object[] { new Integer(1) };
        Statement t = new Statement(mo, "methodB", arguments);
        t.execute();
        MockObject.assertCalled("methodB1", arguments);

        arguments = new Object[] { Boolean.FALSE };
        t = new Statement(mo, "methodB", arguments);
        t.execute();
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.