I am trying to implement the StubProvider Interface as Kevin Poorman does in his blog here: Kevin's Month of Testing Blog - Part 3 of 3 and on line 3 I am getting the error 'Missing return statement required return type: Object.' What could I possibly be doing wrong? Also, because we are in between releases, yes, I am in a sandbox that is running Summer '18, so it isn't (or, shouldn't be) the switch statement causing this issue. Ideas?
@isTest
public class AttachmentTriggerDisabledMockStub implements System.StubProvider {
public Object handleMethodCall(Object stubbedObject, String stubbedMethodName,
Type returnType, List<Type> listOfParamTypes,
List<String> listOfParamNames,
List<Object> listOfArgs){
switch on stubbedMethodName{
when 'Disable_Attachment_AD__c', 'Disable_Attachment_AI__c', 'Disable_Attachment_AU__c'{
return false;
}
}
}
}