Code Cast: Legacy Coderetreat Episode 7 - Extract and Override [Java]

preview_player
Показать описание
During this code cast you can see how to use the Extract and Override technique for making a legacy system testable. This technique's main role is to break static dependencies, or dependencies that make testing (almost) impossible.

The steps described in this video are:
1) Create an empty class that inherits from our production class
2) Extract the static reference to another private method. Test the production code still works
3) Make the extracted method protected
4) Change the test to use the inherited class and not the production class
5) Override the protected method in the new class that inherits from the production class
6) Write the minimum code in order to make the method work
6) Write the assertion for the test
7) Test the production code still works

Programming Language: Java
Рекомендации по теме