Author Rob van Maris
From last week’s JFall conference I picked four of the most interesting sessions I visited to report on:
- Combining the Power of MDA and OCL: Generating Java Code from OCL (and UML) Models – Jos Warmer
- Scripting in Java – Martin Wolf
- Project Jackpot: Refactoring on Steroids – Wilfred Springer
- XP Game – Martien van Steenbergen
Mockobjects are the classic solution to the even more classic problem of how to test code in isolation, when that code needs other objects to perform its tasks. The problem is we want to test classes individually, without introducing too many other objects that may make our tests too complex.
In this article I hope to wet your appetite for this technique. First I will illustrate the problem with a simple example. Then I will demonstrate a solution, using EasyMock to create mockobjects with minimal coding effort.