junit Tutorial

JUnit is a simple framework to write repeatable tests for Java programming language. It is an instance of the xUnit architecture for unit testing frameworks.

Main features consist of:

  • Assertions, that let you customize how to test values in your tests
  • Test runners, that let you specify how to run the tests in your class
  • Rules, that allow you to flexibly modify the behaviour of tests in your class
  • Suites, that allow you to build together a suite of tests from many different classes

Useful extension for JUnit:

  • AssertJ: Fluent assertions for java
  • Mockito: Mocking framework for java