-
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
Top Sales Cloud Features From The Salesforce Winter '22 Release
With each release, Salesforce products become more user-friendly. Salesforce Sales Cloud is already the best sales CRM in the world but this new Salesforce Winter…
Federated Authentication Using SAML to Log in to Salesforce Org
Federated Authentication is one of the SSO(Single Sign On) Methods that uses SAML(Security Assertion Markup Language) assertion sent to the Salesforce endpoint and if everything…
Salesforce Demand tool: Data Quality & Data Cleaning
Hi all, As you all know about the Demand tool which is used for Salesforce data cleaning and maintaining its quality. In this article, you…
Popular Salesforce Videos
Introduction to Salesforce Function | Evergreen
Introduction to Salesforce Function and Evergreen. Deliver event-driven, connected experience fast. Evergreen: Serverless Functions Check out this video to learn everything you need to know…
Education Cloud in Salesforce
Education Cloud is a leading platform that empowers your institution to become a Connected Campus, so you can transform the student journey. With the power…
Customizing and Replacing Sample Salesforce Data
Leverage our sample use case for Salesforce to learn how HyperIntelligence works—and rapidly get your own cards up and running! In this video, we’ll demonstrate…