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
arunatascarunatasc 

using global class methods in test class

Hi salesforce,

 

We are writing test classes.  In our classes, we are using a global class and its methods.

Global Class is "X" and its variables are like "isBlank", etc...

 

How to pass values in test class for these to work?

 

The class contains like this

if (X.isBlank(timeZone))
            {
                X.showError('Time Zone is required.');
                return null;
            }

 

and we are having "timeZone" variable in class which holds a picklist.

 

Please let me know how to pass it.

Mike.KatulkaMike.Katulka

Is the class X ever going to be called from webservices API?  Or from outside of your Salesforce Org? 

 

If not, just use a public class since it will be available everywhere within your Salesforce Org.

 

Otherwise, I think this article might help on Static Methods and Variables.

 

Good luck!

 

Mike.Katulka