September 2016
Intermediate to advanced
454 pages
9h 23m
English
Here is a quick recap of where we left the discussion on unit testing. The intention was to write a unit test for the functionality found in the non-public method, AttackOfTheOrcs._occupy_huts. One straightforward option was to call this method directly from the unit test. However, calling a non-public method is not considered best practice, so we started looking for alternatives. Another option was to refactor AttackOfTheOrcs.play, and use an extracted public method in the unit test. At this point, we took a detour from unit testing and learned the basics of refactoring. Now it is time to refactor AttackOfTheOrcs.play using the techniques we have just learned.
The source code for the game Attack ...
Read now
Unlock full access