[OJB-developers] Unit tests
Brought to you by:
thma
From: Chris G. <CGr...@de...> - 2002-05-05 03:18:33
|
I have a question about unit testing for ObjectBridge. As it stands, the test files are segregated by (1) location and (2) packaging from the production files. The location is understandable, although having ant as a build tool really makes it unnecessary. But the packaging -- having a "test." package prefix for tests -- makes it impossible to test protected methods. If your protected methods happen to be in a base class with several descendants that use those methods frequently, I feel that it's critical to test the methods. But if they're methods that shouldn't be used anywhere outside the base class or its children, then there is no good design reason to make them public -- in fact it really clutters up the public interface of the class. So what is the approach people have taken in the past? Is there a good reason for me not to test protected methods? Is there a compelling reason to put test classes in a different package? As it is, I'll leave out the unit tests I have that test protected methods for the moment. I'd like to commit them, though. Regards, Chris Greenlee |