I'm doing some service calls of which I do not have anything to do with the response. So it's most of like fire and forget thing.
Below is my abstract implementation
class A
{
public void Setup()
{
//This is the only public method of this class which is called from Scheduled Job
//This method retrieves all the required using SOQL
Request(lstWrapperClass);
}
private void Request(List<WrapperClass> lstWrapperClass)
{
//This is a private method and calls the REST API using HTTP Objects.
}
}
All the examples I came across for HttpCalloutMock is calling some static method which returns HTTPResponse which is generally obvious for most of the cases.
But here in my case, I do not need the response. So I have wrapped it into private method. Also the Class being not Static I cannot use Class.Method() nomenclature to call the method.
So I'd like to know that is it mandatory to write Test Class for Callout Methods?
Provided
I can use
Test.isRunningTest()
on Request Method so that it prevent sending the mock data to Web Service.My other code in the class is enough to get more than 75% Coverage.