Trond Andersen
2005-09-13 13:55:10 UTC
This has probably been described earlier, but I couldn't find any
information about this on
http://jmock.codehaus.org/cglib.html
I see that the JavaDocs has a reference to CGLIBCoreMock and a
constructor taking Class and Object array as parameters, but I'm using
the jmock-1.0.1 release and I can't find any such constructors.
So how do I specify constructor parameters when mocking a class? Can I
use the InvocationDispatcher parameter to address these requirements?
If so - how?
My current JUnit tests throws the following exception:=20
Superclass has no null constructors but no arguments were given
java.lang.IllegalArgumentException: Superclass has no null
constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:712)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStra=
tegy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.j=
ava:215)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:654)
at org.jmock.cglib.CGLIBCoreMock.<init>(Unknown Source)
at org.jmock.cglib.CGLIBCoreMock.<init>(Unknown Source)
Thanks
information about this on
http://jmock.codehaus.org/cglib.html
I see that the JavaDocs has a reference to CGLIBCoreMock and a
constructor taking Class and Object array as parameters, but I'm using
the jmock-1.0.1 release and I can't find any such constructors.
So how do I specify constructor parameters when mocking a class? Can I
use the InvocationDispatcher parameter to address these requirements?
If so - how?
My current JUnit tests throws the following exception:=20
Superclass has no null constructors but no arguments were given
java.lang.IllegalArgumentException: Superclass has no null
constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:712)
at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:499)
at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStra=
tegy.java:25)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.j=
ava:215)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:654)
at org.jmock.cglib.CGLIBCoreMock.<init>(Unknown Source)
at org.jmock.cglib.CGLIBCoreMock.<init>(Unknown Source)
Thanks