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.
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
Java (1.6 or 1.7) or Android SDK to develop JUnit tests.
Lmock is delivered as a JAR file, and so should be integrate in the projects like any other jar.
Works in the Mobile group.