The Open Enterprise Foundation


HiMock is a Mock Objects Library for java, it to help test the interactions of objects in isolation using mock object.

This library can rapidly create a mock implementation of any interface or class using dynamic proxies.

Using the himock.jar library:

    mock interface you only need add HiMock library to your CLASSPATH
    mock the class you need add HiMock and CGLIB library to your CLASSPATH
> PS: JUnit is needed all above.

Dynamic Proxies

Dynamic proxies are a feature added to Java 1.3. As you may know, the Proxy Pattern is nothing more than providing implementation through indirection. Essentially, a class can implement an interface and, rather than contain any real logic or computation, it can just redirect calls to another object — hence the name proxy. A dynamic proxy is the same thing. The only difference being that the proxy implementation is created at runtime. This is perfect for creating fake implementations of your services inside of unit tests.