public with sharing class uu{
static c constant =c.getInstance('chjstant');
public static HTTpRequest genequest( String EndPointUrl,String Method,Map<String,String>headerMap,String body ){
HttpRequest req = new HttpRequest();
return req;
}
public Http h = new Http();
HttpResponse res = new HttpResponse();
if(EndPointUrl != null)
{
res = h.send( TReqst( End_Point_Url,Mehod,headep,bdy ) );
}
return re;
}
}
Best Answer
You can create a test response by three implementation- create a mock response class, mock json response from static resorces ,Performing DML Operations and Mock Callouts. Please see the devlopment guide how to test a http request. Link- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing.htm
Example Code For testing-
Mock Http Response class-
Test Class -
As you can see in The test class has statement to set mock response and when a account is insert a trigger that fires a http callout to Google Api get this mock response define in mock test class.