Jeff Verdegan wrote:
In the end, if comes down to this: Why do you want to call yourself an X if you're not going to do the things an X does?
Richard Tookey wrote:
Jeff Verdegan wrote:
In the end, if comes down to this: Why do you want to call yourself an X if you're not going to do the things an X does?
1) Creating mock objects for test purposes; you may only want limited functionality for a particular test.
2) Backwards compatibility when an interface changes and you don't need/want to implement the changes. When upgrading a program (to work both with the current JRE and with a later JRE) that used a connection pool to trace usage I found that SQLConnection had had methods added that were not needed.
3) Creating a cut down version of some system when one does not need all the methods defined in one of the communication classes. For example, the HttpServletRequest passed to the get() method in a very much reduced Servlet container.
There are bound to be more examples.
1) Creating mock objects for test purposes; you may only want limited functionality for a particular test.
James Boswell wrote:
1) Creating mock objects for test purposes; you may only want limited functionality for a particular test.
This isn't really a valid scenario. In this case, you would mock what you need to mock and stub the rest.