XML Feeds

.

[java-dev] Re: Re: Unit testing Java externals that call outlet()

Nick Rothwell nick at cassiel.com
Mon Aug 13 14:19:16 MDT 2007


On 12 Aug 2007, at 23:47, Adam Murray wrote:

> I just spent some time with JMock and can't get it to do what I  
> need. Since the objects I am dealing with are not interfaces, I was  
> looking at this: http://www.jmock.org/mocking-classes.html.

Indeedy - JMock can mock interfaces, not actual classes, which is a  
bit of a pain until/unless you're willing to do a bit of refactoring  
to accomodate. In this case, you'd have to design some kind of facade  
IMaxObject interface (say), and then program against that (and then  
link it into the real MaxObject somehow, perhaps via another concrete  
subclass of MaxObject which implements IMaxObject).

Yes, it's a hassle; probably not worth it for a one-off (old-skool  
stubs are easier), but perhaps worth thinking about for some big- 
project agile/extreme goodness.

	-- N.


Nick Rothwell / Cassiel.com Limited
www.cassiel.com
www.myspace.com/cassieldotcom
www.loadbang.net





More information about the java-dev mailing list