From: Steve F. <st...@m3...> - 2004-05-05 20:18:11
|
Well, you can always just hand code a subclass that does what you want. The Expectations library is quite useful for this. Or you can try the cglib extension to jmock.org, although that's still not quite released. Or you can use the cglib extension to EasyMock. Or you can extract an interface from your class. The trick is to create an instance of the exception (it's just an object), and then throw it in the mock implementation of the method. S Laurent Duperval wrote: > I have created a mock object for a clas that mainly consists of void > methods. I'd like to test the case where calling such a method throws an > exception. The mock object has to extend an abstract class, it's not an > interface. If there is a place that explains how to deal situations like > this, please let me know. |