There are actually people claiming you shouldn't do unit test on private method ? what bullshit is this ???
@Ambraven Are they the same people who claim that unit tests are only useful for refactoring?
I'm beginning to think that some rationnailsation for old c++ users that can't test privates in a clean way so they decided it was bad practice actually.
@Ambraven @jkb For a properly designed type, if a method preserves the invariant it should be public, therefore private methods do not preserve it. Unit tests should verify and document invariants, not specific ways in which some intermediate step in the implementation happened to break them. This might not seem generally applicable, only because crippled (invariant preserving private methods) and leaky (invariant breaking public methods) interfaces are common place and standard practice.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!