function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shubh2910Shubh2910 

Error: Compile Error: Type is not visible

I created a test class for Visualforce page controller. In controller there is a method "send()". In send() I am calling a method of managed package class which contains the logic for web service callout.
But when I am creating a mock in my test class then I am getting the below error :

Error: Compile Error: Type is not visible: signaturepackageservicemock at line 110 column 52

signaturepackageservicemock is class name in Managed Package.
Abhishek BansalAbhishek Bansal
Hi Shubh,

Please find the help on the link given below :
https://developer.salesforce.com/forums/?id=906F00000008u4SIAQ

Let me know if you need any other information on this.

Thanks,
Abhishek Bansal
Martijn SchwarzerMartijn Schwarzer
Hi Shubh2910,

By default, classes and methods in Managed Packages are not visible for you in Apex, unless they are defined as Global. The class you are referring to is probably not defined as global, so you cannot use it in Apex unfortunately.

From Salesforce Help:
The public access modifier declares that this class is visible in your application or namespace. The global access modifier declares that this class is known by all Apex code everywhere.

Best regards,
Martijn Schwärzer
Shubh2910Shubh2910
Thanks Abhishek & Martijn for your reply.

But I am using the latest version of my package then why it is not working?

And if the issue is because of Access modifier then I am using this class in my controller and it is working fine in controller class.