Package com.thoughtworks.proxy.toys.nullobject

Source Code of com.thoughtworks.proxy.toys.nullobject.CglibNullTest$ClassWithPrimitiveParametersInConstructor

package com.thoughtworks.proxy.toys.nullobject;

import com.thoughtworks.proxy.ProxyFactory;
import com.thoughtworks.proxy.ProxyTestCase;
import com.thoughtworks.proxy.factory.CglibProxyFactory;


/**
* @author Aslak Hellesøy
*/
public class CglibNullTest extends ProxyTestCase {

    public static class ClassWithPrimitiveParametersInConstructor {
        private boolean bo;
        private byte by;
        private char ch;
        private int in;
        private long lo;
        private float fl;
        private double db;

        public ClassWithPrimitiveParametersInConstructor(
                boolean bo, byte by, char ch, int in, long lo, float fl, double db) {
            assertEquals(this.bo, bo);
            assertEquals(this.by, by);
            assertEquals(this.ch, ch);
            assertEquals(this.in, in);
            assertEquals(this.lo, lo);
            assertEquals(this.fl, fl, 0);
            assertEquals(this.db, db, 0);
        }
    }

    public void testShouldBeAbleToInstantiateClassWithPrimitiveParametersInConstructor() {
        // The loop is to assert that the method can be called several times, and also measure performance.
        for (int i = 0; i < 10; i++) {
            ClassWithPrimitiveParametersInConstructor o = (ClassWithPrimitiveParametersInConstructor)Null.object(
                    ClassWithPrimitiveParametersInConstructor.class, getFactory());
            assertNotNull(o);
        }
    }

    protected ProxyFactory createProxyFactory() {
        return new CglibProxyFactory();
    }
}
TOP

Related Classes of com.thoughtworks.proxy.toys.nullobject.CglibNullTest$ClassWithPrimitiveParametersInConstructor

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.