Mockito is a mocking framework that tastes really well. It lets you write beautiful tests with clean & simple API. Mockito doesn't give you hangover because the tests are very readable and they produce clean verification errors. Read more about features & motivations.
Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to good design, but this is not always the case. For example final classes and methods cannot be used, private methods sometimes need to be protected or unnecessarily moved to a collaborator, static methods should be avoided completely and so on simply because of the limitations of existing frameworks.
PowerMock is a framework that extend other mock libraries such as EasyMock with more powerful capabilities. PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more. By using a custom classloader no changes need to be done to the IDE or continuous integration servers which simplifies adoption. Developers familiar with EasyMock will find PowerMock easy to use, since the entire expectation API is the same, both for static methods and constructors. PowerMock extends the EasyMock API with a small number of methods and annotations to enable the extra features. From version 1.1 PowerMock also has basic support for Mockito.
When writing unit tests it is often useful to bypass encapsulation and therefore PowerMock includes several features that simplifies reflection specifically useful for testing. This allows easy access to internal state, but also simplifies partial and private mocking.
p-unit
An open source framework for unit test and performance benchmark, which was initiated by Andrew Zhang, under Apache License v2.0. p-unit supports to run the same tests with single thread or multi-threads, tracks memory and time consumption, and generates the result in the form of plain text, image or pdf file.
ClassMock is a framework that helps the creation of unit tests for components that use reflection or annotations. In this kind of classes, the behavior is dependent of the class structure. This way, each test case usually works with a different class created specifically for the test. With ClassMock is possible to define and generate classes in runtime, allowing a better test readability and logic sharing between tests.
pdfUnit is a framework for testing a generated pdf document with the JUnit test framework so JPdfUnit is a high level api. The framework is designed for an easy access to the PDFBox library. This functionality provides the user a lot of possibilities in pdf document handling. For instance you can test the meta data of the pdf document like the author or the creation date or search for content via Strings, fragments of words or even regular expressions. Different simple ready-to-use assertions allow the user to compare the expected data to the concrete data of the pdf document. JPdfUnit is developed to test one pdf document. You have got three different kinds of using the framework i.e. you can inherit our DocumentTestCase shown in the example or you can work with our DocumentTester class to avoid inheritance from our framework.
FEST-Assert is a Java library that provides a fluent interface for writing assertions. Its main goal is to improve test code readability and make maintenance of tests easier.
FEST-Assert requires Java SE 5.0 or later and can be used with either JUnit or TestNG.
Crap4j is a Java implementation of the CRAP (Change Risk Analysis and Predictions) software metric – a mildly offensive metric name to help protect you from truly offensive code.
The CRAP metric combines cyclomatic complexity and code coverage from automated tests (e.g. JUnit tests) to help you identify code that might be particularly difficult to understand, test, or maintain – the kind of code that makes developers say: “This is crap!” or, if they are stuck maintaining it, “Oh, crap!”.
The best way to learn more about CRAP and Crap4j is to check the various articles, newsgroups and blogs about them.