A SOQL query can not be run by using a test class. use if(test.isrunningtest()) condition to skip the SOQL query and assign the values from test class manually to cover the code.
Please, use this in your test method and all will be resolved....
StaticResourceCalloutMock mock = new StaticResourceCalloutMock();
mock.setStaticResource('NameOfStaticResourceContainingResponseBodyString');
mock.setStatusCode(200); // Or other appropriate HTTP status code
mock.setHeader('Content-Type', 'application/json'); // Or other appropriate MIME type like application/xml
Test.setMock(HttpCalloutMock.class, mock);
A SOQL query can not be run by using a test class. use if(test.isrunningtest()) condition to skip the SOQL query and assign the values from test class manually to cover the code.
Hope it works...
Please try this and let me know if it works..
Thanks,
Praveen K.
Please, use this in your test method and all will be resolved....
Here is the link to the implementation this uses:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
Here is the section that covers this in general:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_http_testing.htm
May The SForce Be With You!
Nathan Pepper
youtube.com/MayTheSForceBWithYou
@SForceBeWithYou