How can I access the content of a static resource zip file to create several callout mocks?

I'd like to group all service responses in a single zip file without create several static resources. In the docs I find only

MultiStaticResourceCalloutMock multimock = new MultiStaticResourceCalloutMock(); multimock.setStaticResource( 'http://api.salesforce.com/foo/bar', 'mockResponse'); multimock.setStaticResource( 'http://api.salesforce.com/foo/sfdc', 'mockResponse2');

but no mention of static resource zip files.

  • 2
    I dont think we can zip all in a single file .the main identifier is the name of the static resource .This means we may need separate file names and hence separate static resources for each scenario Jan 15 '13 at 11:27

AFAIK its still missing - see unimplemented idea "Apex system delivered class for ZIP file access" http://success.salesforce.com/ideaView?id=087300000007RhvAAE.

  • Thanks but I think for testing purpose a method like multimock.setStaticResource( 'http://api.salesforce.com/foo/bar', staticresource('Name-of-zip', 'name-of-file')); would be enough. Jan 15 '13 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.