vendredi 15 avril 2016

Test asynchronous non http callout in salesforce

I've read this about testing asyncronous callout and i've a few question. What's the purpose of public String requestLabel in the controller? This label exist only for testing purpose? What if i don't have this label in my controller? Can i still test?

The test class does this Test.setContinuationResponse(controller.requestLabel, response); But i don't have such a label.

Another thing that i couldn't figure out is that i don't do an http callout. My request and response are something like this:

global class LeadManagmetRequest
{
    webservice String Type;
    webservice String Code;
    webservice String Info;
}

global class LeadManagmentResponse
{
    webservice String ExistStatus;
    webservice String ExitCode;
    webservice String Description;
    webservice String LeadCode;
}   

So even if i add the requestLabel in my class when i call Test.setContinuationResponse(MyController.requestLabel, MyResponse); i get a type mismatch error because MyResponse isn't an HttpResponse.

And the last thing: What is Map<String, HttpRequest> requests = conti.getRequests(); ? The asynchronous requests the controller is handling at that time? I've read that is a map of label,requests but who labels that request with a string?

Aucun commentaire:

Enregistrer un commentaire