Package com.thoughtworks.proxy

Source Code of com.thoughtworks.proxy.ProxyFactoryTest

package com.thoughtworks.proxy;

import com.thoughtworks.proxy.kit.Resetter;
import com.thoughtworks.proxy.toys.nullobject.Null;

import java.io.IOException;


/**
* @author Aslak Hellesøy
* @author Jörg Schaible
*/
public class ProxyFactoryTest extends ProxyTestCase {
    public void testShouldNotBeAbleToProxyVoidClass() {
        assertFalse(getFactory().canProxy(Void.class));
        assertFalse(getFactory().canProxy(void.class));
    }

    private void useSerializedFactory(ProxyFactory factory) {
        Resetter resetter = (Resetter)Null.object(Resetter.class);
        assertFalse(resetter.reset(this));
    }

    public void testSerializeWithJDK() throws IOException, ClassNotFoundException {
        useSerializedFactory((ProxyFactory)serializeWithJDK(getFactory()));
    }

    public void testSerializeWithXStream() {
        useSerializedFactory((ProxyFactory)serializeWithXStream(getFactory()));
    }

    public void testSerializeWithXStreamInPureReflectionMode() {
        useSerializedFactory((ProxyFactory)serializeWithXStreamAndPureReflection(getFactory()));
    }
}
TOP

Related Classes of com.thoughtworks.proxy.ProxyFactoryTest

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.