One of the things I'm trying to do in my apex tests is to check that my code is doing the right thing internally, even if it returns the right result, e.g.
- Is it generating the right dynamic SOQL?
- Given a specific scenario, is the right path of function call and branch followed?
- Is the function that is caching the result of a SOQL query actually taking use of its cache for subsequent calls?
- Does an exception happen but is caught by a try/catch block?
Because apex cannot read the Debug Log, I developed my own debug log class that the code uses to store debug information and have the tests verify it.
I am however curious to know what other people have done in the matter. Testing that output of a class or a method given a certain input is useful, but sometimes not enough.