Examples of MockFoo


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

     * bean info class.
     */
    public void testInitialize_Normal() throws Exception {
        CollectingEncoder enc;
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        MockFoo oldBean;
        MockFoo newBean;

        enc = new CollectingEncoder();
        oldBean = new MockFoo();
        oldBean.setName("myName");
        oldBean.setLabel("myLabel");
        pd.writeObject(oldBean, enc);
        enc.clearCache();
        pd.initialize(MockFoo.class, oldBean, new MockFoo(), enc);

        assertNotNull(findStatement(enc.statements(), oldBean, "setName",
                new Object[] { oldBean.getName() }));
        assertNotNull(findStatement(enc.statements(), oldBean, "setLabel",
                new Object[] { oldBean.getLabel() }));

        enc = new CollectingEncoder();
        oldBean = new MockFoo();
        oldBean.setComplexLabel(new MockFooLabel("myComplexLabel"));
        pd.writeObject(oldBean, enc);
        newBean = new MockFoo();
        newBean.setComplexLabel(new MockFooLabel("complexLabel2"));
        pd.writeObject(newBean, enc);
        enc.clearCache();
        pd.initialize(MockFoo.class, oldBean, newBean, enc);
    }
View Full Code Here

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

     * Tests initialize() with null old and new instances.
     */
    public void testInitialize_NullInstances() {
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        Encoder enc = new Encoder();
        MockFoo b = new MockFoo();
        b.setName("myName");
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
View Full Code Here

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

            @Override
            public int hashCode() {
                return super.hashCode();
            }
        }));
        assertFalse(pd.mutatesTo(new MockFoo(), new MockFooStop()));
    }
View Full Code Here

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

     * Tests writeObject() under normal condition when mutatesTo() returns True.
     */
    public void testWriteObject_NormalMutatesToTrue() {
        MockPersistenceDelegate2 pd = new MockPersistenceDelegate2(true);
        MockEncoder2 enc = new MockEncoder2();
        MockFoo foo = new MockFoo();

        pd.writeObject(foo, enc);

        assertEquals("initialize", pd.popMethod());
        assertEquals("mutatesTo", pd.popMethod());
View Full Code Here

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

     * false.
     */
    public void testWriteObject_NormalMutatesToFalse() {
        MockPersistenceDelegate2 pd = new MockPersistenceDelegate2(false);
        MockEncoder2 enc = new MockEncoder2();
        MockFoo foo = new MockFoo();

        pd.writeObject(foo, enc);

        assertEquals("instantiate", pd.popMethod());
        assertEquals("mutatesTo", pd.popMethod());
View Full Code Here

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

     */
    public void testWriteObject_NullEncoder() {
        MockPersistenceDelegate2 pd = new MockPersistenceDelegate2();

        try {
            pd.writeObject(new MockFoo(), null);
            fail("Should throw NullPointerException!");
        } catch (NullPointerException ex) {
            // expected
        }
    }
View Full Code Here

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

        DummyPersistenceDelegate pd = new DummyPersistenceDelegate();
        MockPersistenceDelegate3 pd3 = new MockPersistenceDelegate3();
        Encoder enc = new Encoder();

        enc.setPersistenceDelegate(MockFooStop.class, pd3);
        pd.initialize(MockFoo.class, new MockFoo(), new MockFoo(), enc);
        assertEquals("initialize", pd3.popMethod());
        assertFalse("Extra statement has been detected", pd3.hasMoreMethods());

        // test interface
        pd3 = new MockPersistenceDelegate3();
View Full Code Here

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

    public void testInitialize_circularRedundancy() {
        Encoder enc = new Encoder();
        DummyPersistenceDelegate pd = new DummyPersistenceDelegate();

        enc.setPersistenceDelegate(MockFooStop.class, pd);
        pd.initialize(MockFoo.class, new MockFoo(), new MockFoo(), enc);
    }
View Full Code Here

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

            @Override
            public int hashCode() {
                return super.hashCode();
            }
        }));
        assertFalse(pd.mutatesTo(new MockFoo(), new MockFooStop()));
    }
View Full Code Here

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

            @Override
            public int hashCode() {
                return super.hashCode();
            }
        }));
        assertFalse(pd.mutatesTo(new MockFoo(), new MockFooStop()));
    }
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.