Skip to content

venkat09docs/Maven-Java-Project

Repository files navigation

Java-Maven-Junit-HelloWorld

A „Hello World!” sample written in Java using Maven for the build, that showcases a few very simple tests.

This example demonstrates:

  • Unit tests written with JUnit 4
  • Unit test using PowerMockito to mock classes and test System.exit()
  • Integration tests written with JUnit 4
  • Integration test using system-rules to test System.out
  • Code coverage reports via Soanr.
  • A Maven build that puts it all together

Running the tests

  • To run the unit tests, call mvn test
  • To run the integration tests as well, call mvn verify
  • To generate (unit test) code coverage reports, call mvn sonar:sonar

Conventions

This example follows the following basic conventions:

| unit test | integration test --- | --- | --------- resides in: | src/test/java/*Test.java | src/test/java/*IT.java executes in Maven phase: | test | verify handled by Maven plugin: | surefire | failsafe