On 03/03/2011 02:05 PM, Miroslav Pokorny wrote:
My statements were directed towards using a mocking framework which
implies you have a complex problem so need something a bit more
complex than just creating some dumb interface impl,
If I had interface declarations for everything, for sure I can
mock-without-framework by just creating mock classes that implement the
interfaces.
Now, if the interfaces only declare those methods that are used in a
specific test case, you can do that easily. If they have more methods
that are useless in a specific test case, you still need to implement
them. Of course, it's easy to have them stubbed by an IDE (with the
classic throw UnsupportedOE). In the end, anyway, you end up with a lot
of useless lines of code, and Mockito lets your test to be more
readable. In agile processes, and especially TDD,
Of course, if you have legacy (which can be that you just need to
interact with some library/framework that has concrete classes, e.g.
java.io.File), you can't use interfaces, but this has been already said.
--
Fabrizio Giudici - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
java.net/blog/fabriziogiudici - www.tidalwave.it/people
[email protected]
--
You received this message because you are subscribed to the Google Groups "The Java
Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/javaposse?hl=en.