I worked somewhere with a hard rule that you are not allowed to test internal classes.
So if I write my own sort algorithm I am not allowed to unit test that class
unless I make it public.
But if the sort algorithm is to solve a specific sub problem in a library there is no need to make it public - it may not make much sense.
So I had to test it “through” its consumer class(es) that is public. For illustration sake lets say a MVC controller mocked up to the eyeballs with ORM mocks, logging mocks etc.
This bugged me because having
direct access to a functional
core I can quickly amplify the number of test cases against it and find hidden potential
bugs much quicker.