From: Steve F. <st...@m3...> - 2004-02-26 10:31:39
|
we've been adding support for classes in the new jmock implementation, and I believe that easymock has a similar patch. But I think you're kinda missing the point. Using mocks for stubbing external libraries is a useful technique, but the real point is to use them to drive your design, hence: OnlyMockYourOwnInterfaces. If you're doing TDD, you might want to get some practice with your own code and then let us know how that works out. S. Dmitri Colebatch wrote: > 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 > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > |