You need to sign in to do that
Don't have an account?

Need help in unit testing Informatica Cloud REST API
Hi there,
Does anybody know how to create a unit test for this code below? I came across this when looking for a way to run my Informatica Cloud task in Salesforce remotely. Thanks in advance for the help!
Eric
public with sharing class OrderIntegration { @future (callout=true) public static void runjob(String username, String password, String jobName, String jobType) { HttpRequest req = new HttpRequest(); HttpResponse res = new HttpResponse(); Http http = new Http(); req.setEndpoint('https://app.informaticaondemand.com/saas/api/1/runjob'); req.setMethod('POST'); req.setBody('username='+EncodingUtil.urlEncode(username, 'UTF-8')+ '&password='+EncodingUtil.urlEncode(password, 'UTF-8')+ '&jobName='+EncodingUtil.urlEncode(jobName, 'UTF-8')+ '&jobType='+EncodingUtil.urlEncode(jobType, 'UTF-8')); try { res = http.send(req); } catch(System.CalloutException e) { System.debug('Job Error: '+ e); System.debug(res.toString()); } } }
Hi,
Here is an article covering how to write test methods for web service callouts.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_callouts_wsdl2apex_testing.htm
https://zappysys.com/blog/read-json-informatica-import-rest-api-json-file/
Hope it helps!