I performed " Replace Method with Method Object ", refactoring described by Beck .
Now I have a class with the "run ()" method and a bunch of member functions that decompose the calculations into smaller units. How to check those member functions?
My first idea is that my unit tests are basically copies of the "run ()" method (with different initializations), but with statements between each call to the member functions to check the state of the calculation.
(I am using Python and the unittest module.)
class Train: def __init__(self, options, points): self._options = options self._points = points
I definitely have expectations about what states of member attributes should be before and after calls to various methods as part of the implementation of the run() method. Should I make statements about these "private" attributes? I do not know how else to remove these methods.
Another option is that I really should not test them.
python unit-testing tdd refactoring
user334856
source share