Mock objects for Java unit tests, generated on the fly
open sourceApache-2.0free
EasyMock is a Java library that creates mock objects for interfaces and classes at runtime, so a unit test can stand in for the collaborators of the code under test and check they were called as expected. It was the first dynamic mock object generator for Java, building mocks with Java proxies instead of hand-written classes. It works with JUnit and TestNG, and is an alternative to Mockito.
Problems it solves
- replace a dependency with a fake object in a Java unit test
- check my Java code calls a collaborator the way I expect
- unit test a Java class in isolation without its real database or service
Features
- mocks for interfaces and classes created at runtime
- verifies the calls a test expects
- JUnit and TestNG support
Alternatives
The same job
These do what EasyMock does.
- Mockito Tasty mocking framework for unit tests in Java