This story is unavailable.

You can also do a third refactoring: Parameterize Method, which is the opposite of Extract Factory Method: you extract everything but the first line of convertToHtml into a new method convertToHtmlFromReader, taking a Reader as parameter. Then you can test this method directly in a unit test.

The only downside of this method is that it doesn’t help to test the real convertToHtml method, but it’s the only way to preserve binary compatibility in C++ (in case that matters).

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.