Overview
Needle4j is a lightweight framework for testing Java EE components outside of the container in isolation. The main goals are the reduction of setup code and faster executions of tests, especially compared to running embedded or external server tests.
Needle4j will automatically analyse the dependencies of components and inject mock objects by default. The developer may freely provide default or custom objects instead.
Needle4j is an Open Source library, hosted at github.
GNU Lesser General Public License (LGPL) version 2.1 or later.
Features
- Instantiation of tested components
- Constructor, Method and Field based dependency injection
- Injection of Mock objects by default
- Extensible by providing custom injection providers
- Comfortable automatic wiring of dependency graphs
- Database testing via JPA Provider, e.g.EclipseLink or Hibernate
- EntityManager creation and injection
- Execute optional database operations during test setup and tear down
- Transaction Utilities
- Provide Utilities for Reflection, e.g. for private method invocation or field access
- Needle can be used with JUnit or TestNG.
- It supports EasyMock and Mockito out-of-the-box but could also be extended with other frameworks.