Adding unit tests to legacy code