From the book Working Effectively with Legacy Code:
"If we need to test a private method, we should make it public. If making it public bothers us, in most cases, it means that our class is doing too much and we ought to fix it."
The way to fix it, according to the author, is by creating a new class and adding the method as public
.
The author explains further:
"Good design is testable, and design that isn't testable is bad."
So, within these limits, your only real option is to make the method public
, either in the current or a new class.