I am trying to use maven with Junit4 test cases. Eclipse runs these tests just fine but maven doesn't recognize any of these tests.
Here is the code
import org.junit.Test;
import static org.junit.Assert.*;
public class AdditionTest {
private int x = 1;
private int y = 1;
@Test
public void addition() {
int z = x + y;
assertEquals(2, z);
}
}
POM file
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
Am I doing anything wrong here? Or anything else needs to be done?
Thanks,
Sankar