Why is there so much hating going on about 'partial mocking' and the code that requires it?
Here's an (theoretical) example implementation:
public ComplexResult1 operationA(Stimulus a) {
{
...
result = ...;
}
auditTheChange(a);
}
public ComplexResult2 operationB(Stimulus b) {
{
...
result = ...;
}
auditTheChange(b);
return result;
}
void auditTheChange(Stimulus stim) {
// do a bunch of stuff to record the change
// and interact with another outside service
}
Now, in my understanding this is well refactored code.
If I want to UNIT test operationA and operationB, and ensure that auditing happens in each scenario, but without having to test the specifics of the audit code, I would use partial mocking.
What am I not seeing/understanding that causes so many projects (EasyMock, Mockito, etc.) to recommend refactoring?