Hi Andreas,
not exactly the right list but never mind :-) It's far from perfect, because you have to pass the classes you want to mock as command line parameters. It would have been better to make a Maven plugin with appropriate properties, but I haven't had any time yet.
Put the following dependency in your project.xml (the JAR is not on ibiblio.org, so you have to get it yourself and put it into your local repository):
<dependency> <groupId>mockcreator</groupId> <artifactId>mockcreator</artifactId> <version>2.8.0</version> <type>jar</type> <properties/> </dependency>
And in your maven.xml file put something like the folling:
<preGoal name="test:compile"> <attainGoal name="run-mock-creator"/> <ant:path id="test-gen-src.dir" location="${basedir}/target/test-gen-src"/> <m:addPath id="maven.test.compile.src.set" refid="test-gen-src.dir"/> </preGoal>
<goal name="run-mock-creator"> <ant:path id="mockcreator.classpath"> <ant:path refid="maven.dependency.classpath"/> </ant:path> <ant:java classname="de.abstrakt.tools.codegeneration.file.MockCreatorFile" fork="yes" failonerror="true" classpathref="mockcreator.classpath"> <ant:arg line="-o target/test-gen-src"/>
<!-- For each class to mock add one line with full classname --> <ant:arg value="your.class.to.mock.Class"/>
<ant:classpath> <ant:pathelement path="${maven.build.dest}"/> </ant:classpath> </ant:java> </goal>
Have fun mocking!
Leander
Andreas Guther schrieb:
Hi Leander:
that sounds like an interesting alternative.
would you mind sharing with us the jelly code you wrote about using MockCreator within Maven?
Andreas
M.-Leander Reimer wrote:
Hey Andreas,
nope, never used the XDoclet mock object task myself, just using the webdoclet and ejbdoclet stuff. My XDoclet book just has an example of tagging interfaces not classes.
We are using the MockCreator (http://mockcreator.sourceforge.net/) instead, which can generated mocks from classes and interfaces, so I wrote some Jelly code to use that tool from Maven instead and it works nicely.
Leander
Andreas Guther schrieb:
Leander:
Thank you very much. That helped solving the problem.
Do you have any idea if MockObjects are only generated from Interfaces or from abstract classes as well?
I found in the jelly code the following maven.xdoclet.mockobjectdoclet.mockobjects.${subelement_index}.acceptAbs tractClasses But setting that to true has no effect. maven.xdoclet.mockobjectdoclet.mockobjects.1.acceptAbstractClasses=true
Regards,
Andreas
------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user