Package java.beans

Examples of java.beans.Statement$MethodComparator


     * Note: decided by definition position!
     */
    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();
        MockObject.assertCalled("methodB2", arguments);
    }
View Full Code Here


     * package.
     */
    public void testExecute_ProtectedMethodWithPackage() throws Exception {
        DefaultPersistenceDelegate dpd = new DefaultPersistenceDelegate();
        Object[] arguments = new Object[] { "test", "test" };
        Statement t = new Statement(dpd, "mutatesTo", arguments);
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException e) {
            // expected
        }
    }
View Full Code Here

     */
    public void testExecute_ApplicableViaTypeConversion() throws Exception {
        MockObject mo = new MockObject(false);
        // mo.methodB('c');
        Object[] arguments = new Object[] { new Character((char) 1) };
        Statement t = new Statement(mo, "methodB", arguments);
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException e) {
            // expected
        }
    }
View Full Code Here

     * parameter.
     */
    public void testExecute_IntMethodNullParameter() throws Exception {
        MockObject mo = new MockObject(false);
        Object[] arguments = new Object[] { null };
        Statement t = new Statement(mo, "intMethod", arguments);
        try {
            t.execute();
            fail("Should throw IllegalArgumentException!");
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here

     * Integer array parameter.
     */
    public void testExecute_IntArrayMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Object[] arguments = new Object[] { new Integer[] { new Integer(1) } };
        Statement t = new Statement(mo, "intArrayMethod", arguments);
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

     * int array parameter.
     */
    public void testExecute_IntegerArrayMethod() throws Exception {
        MockObject mo = new MockObject(false);
        Object[] arguments = new Object[] { new int[] { 1 } };
        Statement t = new Statement(mo, "integerArrayMethod", arguments);
        try {
            t.execute();
            fail("Should throw NoSuchMethodException!");
        } catch (NoSuchMethodException ex) {
            // expected
        }
    }
View Full Code Here

     * Test for special case of overloaded method execute
     */
    public void testExecute_AmbiguousOverloadedMethods() throws Exception {
        MockObject mo = new MockObject();
        Object[] arguments = new Object[] { new MockObject(), new MockObject() };
        Statement t = new Statement(mo, "overloadedMethod", arguments);
        t.execute();
        MockObject.assertCalled("overloadedmethod", arguments);
       
        arguments = new Object[] { new MockParent(), new MockParent() };
        t = new Statement(mo, "overloadedMethod", arguments);
        t.execute();
        MockObject.assertCalled("overloadedmethod2", arguments);
       
        arguments = new Object[] { new MockObject(), new MockObject() };
        t = new Statement(mo, "overloadedMethodB", arguments);
        try{
            t.execute();
            fail("should throw Exception");
        }catch(Exception e){
        }
       
        arguments = new Object[] { new MockObject(), new MockParent() };
        t = new Statement(mo, "overloadedMethodB", arguments);
        t.execute();
        MockObject.assertCalled("overloadedmethodB", arguments);
    }
View Full Code Here

    /**
     * The test checks the method execute() for setter
     */
    public void testSetter() throws Exception {
        Bean bean = new Bean();
        Statement s = new Statement(bean, "setText", new Object[] { "hello" });
        s.execute();
        assertEquals("hello", bean.getText());
    }
View Full Code Here

    /**
     * The test checks the method execute() for indexed setter
     */
    public void testIndexedSetter() throws Exception {
        Bean bean = new Bean("hello");
        Statement s = new Statement(bean, "setChar", new Object[] {
                new Integer(1), new Character('a') });
        s.execute();
        assertEquals("hallo", bean.getText());
    }
View Full Code Here

    /**
     * The test checks the method execute() for array setter
     */
    public void testArraySetter() throws Exception {
        int[] a = { 1, 2, 3 };
        Statement s = new Statement(a, "set", new Object[] { new Integer(1),
                new Integer(7) });
        s.execute();
        assertEquals(7, a[1]);
    }
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.