1 Jan 2006 19:07
Re: is JMock a good choice to test Filters?
On 12/31/05, Dale King <dalewking@...> wrote: > And I think the advice of Only Mock types that you own is pretty poor advice > and isn't really helpful. The real question is not whether someone else owns > it but whether they did a good design that allowed for substitution, which > you usually means did they expose the type as an interface or abstract > class.. Our intention behind the "Only Mock Types You Own" rule was to emphasise jMock's use as a design tool. That jMock is meant to be used like a CRC card session with the computer. Yes, you can mock a third-party interface but what do you do when you find that the interface isn't quite right: that it doesn't have the methods you need or that the names aren't quite right? You're stuck. Mocking third-party interfaces lets you design the object under test but that's only part of what we found we used jMock for. More important, we found, was its help in designing the interactions *between* objects, but you don't get that help if you cannot change the interactions themselves. Also, in my experience, mocking interfaces provided by third-party libraries leads to gradual breakdown of clean layering and modularisation. When teams test domain model code by mocking technology layer interfaces, irrelevant concepts from the underlying technologies leak into the domain model. This makes it harder to understand the domain model and hard to switch technologies further down the line. More important than the "Only Mock Types You Own" rule was that we learned to drive the design of interfaces from the needs of the caller(Continue reading)
RSS Feed