You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dennis Ho <dh...@paymentone.com> on 2005/12/28 07:08:42 UTC

[m2] Migrating mockobject calls to Maven2

Hi,

	I am in the process of migrating some existing maven tasks to
use maven 2.  We use mockobjects in our code for testing purposes, and I
would like to know if anyone has experience using maven2 with
mockobjects can give me some pointer as to how the pom should look like.

	When we did it with maven 1.x we have to use ant like the
following:

    <ant:java
classname="de.abstrakt.tools.codegeneration.file.MockCreatorFile" 
      fork="yes" failonerror="true"
classpathref="mockcreator.classpath">

      <ant:arg line="-o ${maven.build.dir}/generated-sources/mocked"/>
      <!-- 
      	For each class to mock add one line with full classname 
      -->
      
      <ant:arg value="SomeClass"/>
      
      <ant:classpath>
        <ant:pathelement path="${maven.build.dest}"/>
      </ant:classpath>
    </ant:java>

Is there a more natural way to do it in Maven 2?   I can't find anything
from the web so any advice is welcome.  

Thanks in advance for your help!

Regards,

Dennis Ho.

Re: [m2] Migrating mockobject calls to Maven2

Posted by Jörg Schaible <jo...@gmx.de>.
David Sag wrote:

> We use EasyMock and all that needs is to put the folllowwing in the pom.
> there are no generated files like with what you describe however.  it
> makes great little mockobjects though using the cglib.
> 
>         <dependency>
>             <groupId>easymock</groupId>
>             <artifactId>easymock</artifactId>
>             <version>1.2_Java1.3</version>
>             <scope>test</scope>
>         </dependency>
>  
>         <dependency>
>             <groupId>easymock</groupId>
>             <artifactId>easymockclassextension</artifactId>
>             <version>1.1</version>
>             <scope>test</scope>
>         </dependency>
> 
> Kind regards,
> Dave Sag

We use for the same purpose jMock. Same idea for mocks, different approach
for the coding. See http://www.jmock.org/easymock-comparison.html and take
what you like more.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Migrating mockobject calls to Maven2

Posted by David Sag <ds...@epo.org>.
We use EasyMock and all that needs is to put the folllowwing in the pom. 
there are no generated files like with what you describe however.  it 
makes great little mockobjects though using the cglib.

        <dependency>
            <groupId>easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>1.2_Java1.3</version>
            <scope>test</scope>
        </dependency>
 
        <dependency>
            <groupId>easymock</groupId>
            <artifactId>easymockclassextension</artifactId>
            <version>1.1</version>
            <scope>test</scope>
        </dependency>

Kind regards,
Dave Sag 




 

"Dennis Ho" <dh...@paymentone.com> wrote on 28-12-2005 07:08:42:

> Hi,
> 
>    I am in the process of migrating some existing maven tasks to
> use maven 2.  We use mockobjects in our code for testing purposes, and I
> would like to know if anyone has experience using maven2 with
> mockobjects can give me some pointer as to how the pom should look like.
> 
>    When we did it with maven 1.x we have to use ant like the
> following:
> 
>     <ant:java
> classname="de.abstrakt.tools.codegeneration.file.MockCreatorFile" 
>       fork="yes" failonerror="true"
> classpathref="mockcreator.classpath">
> 
>       <ant:arg line="-o ${maven.build.dir}/generated-sources/mocked"/>
>       <!-- 
       For each class to mock add one line with full 
> classname 
      -->
> 
>       <ant:arg value="SomeClass"/>
> 
>       <ant:classpath>
>         <ant:pathelement path="${maven.build.dest}"/>
>       </ant:classpath>
>     </ant:java>
> 
> Is there a more natural way to do it in Maven 2?   I can't find anything
> from the web so any advice is welcome. 
> 
> Thanks in advance for your help!
> 
> Regards,
> 
> Dennis Ho.