To mock a callout if the code that performs the callout is in a managed package, call Test. setMock from a test method in the same package with the same namespace. … It then verifies that the response returned is what the implemented respond method sent.