3 ms·
If you’re asserting non-public internals of a class, your testing is wrong in the first place. Assert outcomes, not the process.
by kortilla 6y ago
If you’re asserting non-public internals of a class, your testing is wrong in the first place. Assert outcomes, not the process.
- nightski 6y agoThat's the whole point. You can't test outcomes if they are dependent on internal hidden state as that affects the outcome. Whether you make it private or not hidden state leaks into the output since the output is dependent on it.
- kortilla 6y agoIt sounds like you’re confusing side effect free code with OOP. You can use OOP while having side effect free stuff that never requires you to assert internals.