Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Nope, it is enough that the class to be mocked implements an interface, no need to extend anything. This is also clearly stated in the sentence from the book. Commented Nov 24, 2011 at 12:40
  • This is bad practice (in my opinion) to extend a class to mock it. Mock is all about behaviour testing, they're designed to mimic the implementation of an INTERFACE. At least that's what the purist and the original creators of the mock concept said. If you properly design your system using dependency injection and interfaces, you'll have no problem using BDD and mocking. Commented Nov 25, 2011 at 10:53