All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.proxy.samples.KeySample Maven / Gradle / Ivy

Go to download

EasyMock provides an easy way to create Mock Objects for interfaces and classes generating them on the fly

There is a newer version: 5.2.0
Show newest version
package samples;
import org.easymock.cglib.core.KeyFactory;
public class KeySample {
    private interface MyFactory {
        public Object newInstance(int a, char[] b, String d);
    }
    public static void main(String[] args) {
        MyFactory f = (MyFactory)KeyFactory.create(MyFactory.class);
        Object key1 = f.newInstance(20, new char[]{ 'a', 'b' }, "hello");
        Object key2 = f.newInstance(20, new char[]{ 'a', 'b' }, "hello");
        Object key3 = f.newInstance(20, new char[]{ 'a', '_' }, "hello");
        System.out.println(key1.equals(key2));
        System.out.println(key2.equals(key3));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy