Java News from Friday, July 25, 2008

Tammo Freese has released EasyMock 2.4, an open source mock object framework that "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." Personally I think MockObjects are vastly overused If you're making a type an interface just so you can mock it, the testing cart has started to drive the design horse. However they can sometimes be useful in cases where the natural design lends itself to being mocked. As long as you can resist the temptation to contort and complexify an API to support testing, mock objects can be useful. EasyMock is published under an MIT license.