I have a apex class that calls the API from a managed package (Zuora Order Builder) and these API calls' implementation (within managed package) have web service callouts to an external system (Zuora). To write a test class for my apex class, if I just call my class methods which in turn call the managed API, it will give error that test class can not have callouts. Ideally, I would like to be able to mock the managed API calls I use, similar to mocking http and webservice. I wonder if this is possible in SF and how it can be done.
There is a pilot in the Winter'17 Release Notes;
Apex now provides a stub API for implementing your own mocking framework. You can define the behavior of stub objects, which are created at runtime as anonymous subclasses of Apex classes. The stub API is composed of the System.StubProvider interface and the System.Test.createStub() method.
You could try and get on the pilot program via your Account Executive. Otherwise you will need to wait for it to become either a public beta or generally available.