jMock: the latest mock library for Java
May 27, 2004 04:04 · 144 words · 1 minute read
Via Erik’s always helpful Linkblog, jMock – A Lightweight Mock Object Library for Java. This started as a fork of the mockobjects.com DynaMock package (which I was using earlier today, in fact). I’ll give this one points on readability, which is certainly important in tests. I have to subtract points, though, because you need to extend their base class (or at least that’s all they show in the examples I’ve seen thus far), which is not always an option. Also, the readbility does come at the cost of verbosity, and I’m not completely sure about that.
Something that might be interesting would be to create a mockobjects package in Groovy. Since Groovy is dynamically typed, you don’t have quite the same pain in dealing with all of Java’s primitive types. That was one of the complaints the jMock authors had about the DynaMock way.