I have a test class containing several WebServiceMock
implementors. He looks like this:
@isTest private class MyTestClass {
public class ValidateMock implements WebServiceMock {
public void doInvoke(Object stub, Object request, Map<String, Object> response, String endpoint, String soapAction, String requestName, String responseNS, String responseName, String responseType) {
//...
}
}
static testMethod void coverRetrieve() {
Test.setMock(WebServiceMock.class, new ValidateMock());
//...
System.assert(result instanceof Object);
}
}
But as I create more WebServiceMocks, I see the Code Coverage metrics for my org going south!
Of course, I tried to annotate the WebServiceMock inner classes with @isTest
but will get:
Only static top-level class methods can be test methods
(Which they should be, anyway, as inner classes of an @IsTest
annotated class)
Currently I think my options are:
write a "Test Test" method that invokes all the mocks just to bump the coverage,
proliferate all the WebServiceMock classes as top-level, then add the
@isTest
annotation,
How else could I prevent these test inner classes being seen by the code coverage metrics?