Created
November 11, 2012 07:47
-
-
Save msakamoto-sf/4054100 to your computer and use it in GitHub Desktop.
Java + Groovy + TestNG + Maven combination example2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gjt2; | |
public class Calc { | |
private int v1; | |
private int v2; | |
public Calc(int a, int b) { | |
v1 = a; | |
v2 = b; | |
} | |
public int calc() { | |
return v1 + v2; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gjt2; | |
import org.testng.Assert; | |
import org.testng.annotations.Test; | |
public class CalcTest { | |
@Test | |
public void calc() { | |
Calc c = new Calc(10, 20); | |
Assert.assertEquals(c.calc(), 30); | |
c.v1 = 1; | |
c.v2 = 2; | |
Assert.assertEquals(c.calc(), 3); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>gjt2</groupId> | |
<artifactId>gjt2</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>gjt2</name> | |
<url>http://maven.apache.org</url> | |
<dependencies> | |
<dependency> | |
<groupId>org.codehaus.groovy</groupId> | |
<artifactId>groovy-all</artifactId> | |
<version>1.8.8</version> | |
</dependency> | |
<dependency> | |
<groupId>org.testng</groupId> | |
<artifactId>testng</artifactId> | |
<version>[6.8,)</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.codehaus.gmaven</groupId> | |
<artifactId>gmaven-plugin</artifactId> | |
<version>1.4</version> | |
<configuration> | |
<providerSelection>1.8</providerSelection> | |
</configuration> | |
<executions> | |
<execution> | |
<goals> | |
<goal>generateStubs</goal> | |
<goal>compile</goal> | |
<goal>generateTestStubs</goal> | |
<goal>testCompile</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment