Another Good Tidbit from GOOSGBT
I’m currently in chapter 12 of Growing Object Oriented Software Guided By Tests and thought I’d share another good tidbit from one of the asides:
Put Tests in a Different Package
We’ve adopted a habit of putting tests in a different package from the code they’re exercising. We want to make sure we’re driving the code through its public interfaces, like any other client, rather than opening up a package-scoped back door for testing.
Good point! Almost everytime I’ve found my self expose a method that should be private as protected or default it’s been because that method was really in gross violation of Single Responsibility Principle and I’ve often taken such code and extracted it to a separate object.
Thoughts?
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!














March 9th, 2010 at 11:14 pm
You would probably just start doing more of your favorite test hack: the “self-shunt”