From: Dmitri C. <moc...@co...> - 2004-02-26 04:50:18
|
hey all, I've _almost_ used mock objects several times over the last year or so, but never quite taken the final step. I'm currently at that point again, this time to improve our test coverage in relation to SAP. We use JCO to connect to SAP, and my current need is to come up with some way to run our tests without involving SAP. Obvious solution: mock objects. Couple of problems. Firstly is this wiki page: http://www.mockobjects.com/wiki/OnlyMockYourOwnInterfaces I disagree with the idea of reimplementing an interface to an external party, especially in a scenario like this where changing the way we talk to SAP is going to change code regardless of how many layers we put in. However, I'm not terribly worried about this. The real problem is the reliance on java.lang.reflect.Proxy. This only allows for interfaces. I'm wondering if anyone has ever looked at making mocks of classes? Using user-provided instances, with interceptors, I dont imagine it would be too hard to do, but would like to hear from you guys who know the code a lot better than I do. thoughts? cheers dim |