Package java.beans

Examples of java.beans.Statement$MethodComparator


     * Test the method execute() with a normal object, a valid method that
     * throws an exception and valid arguments.
     */
    public void testExecute_ExceptionalMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Statement t = new Statement(mo, "method", new Object[] { null, null });
        try {
            t.execute();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
        MockObject.assertCalled("method4", new Object[] { null, null });
View Full Code Here


     * Test the method execute() with a normal object and a non-existing method
     * name.
     */
    public void testExecute_NonExistingMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Statement t = new Statement(mo, "method_not_existing", new Object[] {
                null, null });
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

    /*
     * Test the method execute() with a null object.
     */
    public void testExecute_NullTarget() throws Exception {
        Statement t = new Statement(null, "method_not_existing", new Object[] {
                null, null });
        try {
            t.execute();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
    }
View Full Code Here

     * Test the method execute() with a normal object, a valid method and
     * invalid arguments (in terms of type, numbers, etc.).
     */
    public void testExecute_InvalidArguments() throws Exception {
        MockObject mo = new MockObject(false);
        Statement t = new Statement(mo, "method", new Object[] { new Object(),
                new Object(), new Object() });
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

     * valid arguments.
     */
    public void testExecute_OverloadedMethods() throws Exception {
        MockObject mo = new MockObject(false);
        Object[] arguments;
        Statement t;

        arguments = new Object[] { new Object() };
        t = new Statement(mo, "method", arguments);
        t.execute();
        MockObject.assertCalled("method2", arguments);

        arguments = new Object[] { "test" };
        t = new Statement(mo, "method", arguments);
        t.execute();
        MockObject.assertCalled("method3", arguments);

        arguments = new Object[] { new Integer(117) };
        t = new Statement(mo, "method", arguments);
        t.execute();
        MockObject.assertCalled("method1-3", arguments);
    }
View Full Code Here

    /*
     * Test the method execute() with a normal object, the method name "new" and
     * valid arguments.
     */
    public void testExecute_NormalConstructor() throws Exception {
        Statement t = new Statement(MockObject.class, "new", new Object[0]);
        t.execute();
        MockObject.assertCalled("new0", new Object[0]);
        t = new Statement(MockObject.class, "new", null);
        t.execute();
        MockObject.assertCalled("new0", new Object[0]);
    }
View Full Code Here

     * Test the method execute() with a normal object, normal constructor ("new"
     * method) and null arguments.
     */
    public void testExecute_NormalConstructorNull() throws Exception {
        Object[] arguments = new Object[] { null, null };
        Statement t = new Statement(MockObject.class, "new", arguments);

        try {
            t.execute();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
        MockObject.assertCalled("new4", arguments);
View Full Code Here

    /*
     * Test the method execute() with a normal object, the method name "new"
     * that throws an exception and valid arguments.
     */
    public void testExecute_ExceptionalConstructor() throws Exception {
        Statement t = new Statement(MockObject.class, "new", new Object[] {
                null, null });
        try {
            t.execute();
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
        MockObject.assertCalled("new4", new Object[] { null, null });
View Full Code Here

    /*
     * Test the method execute() with a normal object, the method name "new" and
     * invalid arguments (in terms of type, numbers, etc.).
     */
    public void testExecute_NonExistingConstructor() throws Exception {
        Statement t = new Statement(MockObject.class, "new", new Object[] {
                null, null, null, null });

        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

     * Test the method execute() with a normal object with overloaded
     * constructors, the method name "new" and valid arguments.
     */
    public void testExecute_OverloadedConstructors() throws Exception {
        Object[] arguments = new Object[] { new Object() };
        Statement t = new Statement(MockObject.class, "new", arguments);
        t.execute();
        MockObject.assertCalled("new2", arguments);

        arguments = new Object[] { "test" };
        t = new Statement(MockObject.class, "new", arguments);
        t.execute();
        //FIXME: the following 2 commented assert cannot pass neither in RI nor in Harmony (HARMONY-4392),
        // waiting for dev-list approval to fix Harmony implementation following spec       
//         MockObject.assertCalled("new3", arguments);

        Object[] arguments2 = new Object[] { new Integer(1) };
        t = new Statement(MockObject.class, "new", arguments2);
        t.execute();
//        MockObject.assertCalled("new1-2", arguments2);
    }
View Full Code Here

TOP

Related Classes of java.beans.Statement$MethodComparator

Copyright © 2018 www.massapicom. 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.