Package org.apache.cayenne.reflect

Examples of org.apache.cayenne.reflect.CallbackOnEntity


import junit.framework.TestCase;

public class CallbackOnEntityTest extends TestCase {

    public void testPublicCallbackMethod() {
        CallbackOnEntity callback = new CallbackOnEntity(
                MockCallingBackEntity.class,
                "publicCallback");

        MockCallingBackEntity e = new MockCallingBackEntity();
        callback.performCallback(e);
        assertTrue(e.publicCallbackInvoked);
        assertFalse(e.protectedCallbackInvoked);
        assertFalse(e.privateCallbackInvoked);
        assertFalse(e.defaultCallbackInvoked);
    }
View Full Code Here


        assertFalse(e.privateCallbackInvoked);
        assertFalse(e.defaultCallbackInvoked);
    }

    public void testProtectedCallbackMethod() {
        CallbackOnEntity callback = new CallbackOnEntity(
                MockCallingBackEntity.class,
                "protectedCallback");

        MockCallingBackEntity e = new MockCallingBackEntity();
        callback.performCallback(e);
        assertFalse(e.publicCallbackInvoked);
        assertTrue(e.protectedCallbackInvoked);
        assertFalse(e.privateCallbackInvoked);
        assertFalse(e.defaultCallbackInvoked);
    }
View Full Code Here

        assertFalse(e.privateCallbackInvoked);
        assertFalse(e.defaultCallbackInvoked);
    }

    public void testPrivateCallbackMethod() {
        CallbackOnEntity callback = new CallbackOnEntity(
                MockCallingBackEntity.class,
                "privateCallback");

        MockCallingBackEntity e = new MockCallingBackEntity();
        callback.performCallback(e);
        assertFalse(e.publicCallbackInvoked);
        assertFalse(e.protectedCallbackInvoked);
        assertTrue(e.privateCallbackInvoked);
        assertFalse(e.defaultCallbackInvoked);
    }
View Full Code Here

        assertTrue(e.privateCallbackInvoked);
        assertFalse(e.defaultCallbackInvoked);
    }

    public void testDefaultCallbackMethod() {
        CallbackOnEntity callback = new CallbackOnEntity(
                MockCallingBackEntity.class,
                "defaultCallback");

        MockCallingBackEntity e = new MockCallingBackEntity();
        callback.performCallback(e);
        assertFalse(e.publicCallbackInvoked);
        assertFalse(e.protectedCallbackInvoked);
        assertFalse(e.privateCallbackInvoked);
        assertTrue(e.defaultCallbackInvoked);
    }
View Full Code Here

        assertTrue(e.defaultCallbackInvoked);
    }

    public void testStaticCallbackMethod() {
        try {
            new CallbackOnEntity(MockCallingBackEntity.class, "staticCallback");
            fail("Static methods can't be used as callbacks");
        }
        catch (IllegalArgumentException e) {
            // expected
        }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.reflect.CallbackOnEntity

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.