-
How can I cover the code coverage for multiple conditions in IF statement in Salesforce?
Below is the code for class:
public class ControllerHelper
{
public static boolean validate (Case obj)
{
if((obj.field1 = 'Yes' || obj.field2 = 'Yes') && checkNullValue(obj.field3))
||
((obj.field4 = 'Yes' || obj.field5 = 'Yes') && checkNullValue(obj.field6))
)
return true;
else
{
return false;
}
}public static boolean checkNullValue(String value)
{
if(value==null || value.trim().length()==0)
{
return true;
}
return false;
}
}
Log In to reply.
Popular Salesforce Blogs
Salesforce Automation Tools - Document Generation Made Easy
While running a business, there are so many important documents and records that need resources and time for their management. In an organization, generating documents…
Problem Solving | Salesforce Project Implementation
'I am happy to help you', I replied to a post on a Salesforce group. A group member posted a roadblock in his recent Salesforce…
All You Need to Know About Lightning-tabset and Lightning-tabs in Salesforce
What is a Lightning-tabset? A Lightning-tabset represents a list of tabs. A lightning-tabset displays a tabbed container with multiple content areas, only one of which is…
Popular Salesforce Videos
Introduction to Salesforce Commerce Cloud for Developers
Commerce Cloud powers e-commerce for many of the world's leading brands and it represents a great opportunity for developers around the world. Join us to…
4 Benefits of Salesforce Data Services (ETL)
When your enterprise needs to integrate data from a different application, Salesforce Data Services will help your company in Extracting, Transforming, and Loading the gathered…
Streamline Sales Goals and Add Value to Your B2B Organization With Salesforce Marketing Automation
Salesforce Marketing Automation enables businesses to automate marketing processes, track customer engagement while delivering personalized experiences to each customer. With it, you can streamline and…