JUnit4-and-Maven-Example is a project mainly written in Java, it's free.
A minimal example that demonstrates how to use JUnit 4 and Maven
Project Title: JUnit4 and Maven Example Description: A minimal example. Demonstrates how to use JUnit4 and Maven Project URL: git://github.com/sastay/JUnit4-and-Maven-Example.git
Author: Sascha Tayefeh Author URL: http://www.tayefeh.de Date: 2010-07-10
When I migrated an old project from JUnit3 to JUnit4, I ran into some problems. mvn:test produced an error:
[SNIP STOP]
The test classes were no longer available. I found that I had to
This project provides a trivial scenario (refer to src/test/java/minimal/DoSomeActionTest.java):
package minimal;
import static org.junit.Assert.assertTrue; import org.junit.Test;
/**
[SNIP STOP]
Also mind the pom.xml which includes the maven-compiler-plugin to enforce Java 1.6 incl. annotations:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
[SNIP STOP]
When running mvn:test you should get following positive message:
Running minimal.DoSomeActionTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[SNIP STOP]
Ref: