Here are the basic steps as to how I set up “passing” project using maven & eclipse for the coding exercises. If you are using other IDEs or command line approach then you can ignore this prerequisite. Just create the relevant packages and copy the classes in the passing the test exercises. Using Maven or not, you need the 2 jar files as dependencies to use JUnit.
Step 1: Set up Java, Maven, and Eclipse on your machine following the steps in Setting up Java, Maven, and eclipse
Step 2: Generate a simple project using Maven
c:\folder> mvn archetype:generate -DgroupId=com.passing.unittests -DartifactId=passing
Step 3: This should create a basic Maven structure with a pom.xml shown below. We need JUnit framework to write unit tests.
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.passing.unittests</groupId>
<artifactId>passing</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>passing</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Step 4: You can import this into eclipse with File –> Import. and then “Existing Maven Projects”, and then select
Press next, and tick the check box shown below
Step 5: You can now start working within eclipse. You can create new classes, etc.
Just create the relevant packages and copy the classes in the passing the test exercises.