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.
ClassMock is available at http://classmock.sourceforge.net/
SevenMock v1.1 has now been released. The distribution archive is available on SourceForge at:
http://downloads.sourceforge.net/seven-mock
The major addition to be found in this version is a class extension sub-project, which allows the generated mock objects to be cast directly to classes as well as the interfaces that they implement.
Java mocking is dominated by expect-run-verify libraries like EasyMock or jMock. Mockito offers simpler and more intuitive approach: you ask questions about interactions after execution. Using mockito, you can verify what you want. Using expect-run-verify libraries you often look after irrelevant interactions.
Mockito has similar syntax to EasyMock, therefore you can refactor safely. Mockito doesn't understand the notion of 'expectation'. There is only stubbing or verifications.
Read more: http://mockito.googlecode.com
SevenMock is a light-weight Java dynamic mock objects implementation.
It works in a similar way to EasyMock and jMock, but is unusual in that it places responsibility for verifying operation parameters directly on the unit test code by use of expectation call-backs. This enables the test designer to write very clear, precisely targeted tests and makes test failures easier to diagnose - any stacktrace produced will point directly back to test code rather than framework code.
The MockFtpServer (http://mockftpserver.sourceforge.net/) project provides a mock/dummy FTP server implementation that is very useful for testing of FTP client code. It can be configured to return custom data or reply codes, to simulate either success or failure scenarios. Expected command invocations can also be verified.
MockFtpServer is written in Java, and is ideally suited to testing Java code. But because communication with the FTP server is across the network using sockets, it can be used to test FTP client code written in any language.
Mocklib is a library that simulates entire apis(as well as the usual single interfaces). It is designed for module unit testing rather than single class testing. Thus when a module is refactored, tests do not need to be changed as much. More help with mocklib can be found in the following article... http://www.devx.com/Java/Article/34990
Project is located on sourceforge at http://mocklib.sourceforge.net/mocklib3/index.html
JMock is a library that supports test-driven development of Java code with mock objects.Mock objects help you design and test the interactions between the objects in your programs.
The jMock library:
MockEjb is a lightweight framework for running EJBs outside of the container for unit testing. MockEjb allows you to run EJBs directly from your favorite IDE with the minimal setup effort. MockEjb is not a full-blown (or even half-blown) EJB container. MockEjb does not fully implement EJB or any other J2EE spec. It merely provides a convenient and realistic EJB testing environment using mock objects approach.
Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports Struts actions and forms, servlets, filters and tag classes. Furthermore it includes a JDBC test framework. The JDBC test framework can be used standalone or in conjunction with MockEJB to test EJB based applications.
EasyMock provides Mock Objects for interfaces in JUnit tests by generating them on the fly using Java's proxy mechanism. Due to EasyMock's unique style of recording expectations, most refactorings will not affect the Mock Objects. So EasyMock is a perfect fit for Test-Driven Development.