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
Mark RootMark Root 

How to deprecate a global test method in a managed package

I need to upgrade an Apex Class of a managed package from API version 24 to version 38 in order to take advantage of the relatively new Work Order object.  Because the Class uses an older API version, it contains a global static test method which I'm unable to remove because it's part of a managed package.  I'm also not able to comment it out using @deprecate and so what can I do to get around this problem?
Rowallim TechnologyRowallim Technology
Hi Mark
You can deprecate the method by using the @deprecated annotation:
   global static void MyMethood(){
This will prevent new subscribers of your package from seeing that method.
Existing subscribers, however, will still be able to access the method.
Hope this will help you.
Please mark it best answer if it helps.
Mark RootMark Root
Tried that already and here's the error I get:
Error: Compile Error: Test methods must be in test classes at line 829 column 35
Mark RootMark Root
This issue has been resolved.  Turns out that it was a combination of using @deprecated and commenting out everything inside the method, and that did the trick.