In decorators/wrappers, a lot of method are just calling the methods with the same names on the underlying object.
I consider writing the standard mock-based tests for these bad as they are effectively verifying the Java language works.
However, the methods are still worth testing just in case a copy and paste error caused the wrong underlying method to be called.
So I am considering using reflection to test them. In the current design, I will supply a List
of method names and the test will call them using reflection and then use a similar call on the mock to verify the invocation.
Still, I find this fiddly and needs special handling for overloads. Just wondering if there are other ways to do this?
Aucun commentaire:
Enregistrer un commentaire