Summary
Lmock is another mocking framework for Java, initially targeting Google’s Android OS, but actually works on any environment.
Details on what a mocking framework is for can be found on the wikipedia article: http://en.wikipedia.org/wiki/Mock_object
Although many frameworks are already available, none of them seems to give satisfying results to Android developers. They are either difficult to integrate or not usable at all.
Lmock was thought as a multi-platform mocking system, working from common Java environments (JRE 5/6 + JUnit 3/4) to Android. Lmock integrates a simple programming model to test multi-threaded applications.
Features
Lmock integrates the common features of mocking systems:
- Possibility to create stubs on specific methods
- Possibility to specify expectations so that the test checks if an invocation actually happens
Lmock comes up with two possible syntaxes:
- “JMock” style: explicitly declare the different resources contributing to the test
- “Mockito” style: uses spies in the code, in order to create expectations and stubs on the fly
System Requirements
Java (1.6 or 1.7) or Android SDK to develop JUnit tests.
Instructions
Lmock is delivered as a JAR file, and so should be integrate in the projects like any other jar.
Video
Change Log
Engineers
![]() | David FurodetWorks in the Mobile group. |

For any question or support request, please send an e-mail to: lmock@vmware.com
You can find a quick tutorial on Lmock’s github wiki: https://github.com/vmware/lmock/wiki
For more detailed documentation, see the pdf files under the doc directory of the source code.