Vincent et al

A general question regarding mock objects: When unit testing with mock
objects, there is a general desire to break algorithms up into distinct
parts and pass mock objects in and out of these algorithms. These
fine-grained algorithms become separate methods that are usually candidates
for private protection (in Java). However, since most unit tests are a
separate class ([ClassToTest]Test.java), these algorithms become friendly at
best (test class in package), public at worst. When this happens, the
contract of the class is significantly extended (at least, within the
package). Is this an unavoidable externality of fine-grained, comprehensive
unit testing? Or is there a way, perhaps with inner classes, to retain
private protections on methods not useful for other package or general
classes, but enable granular unit testing?

Tom
http://calivera.manilasites.com




Reply via email to