-
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
Setting SSO Between Salesforce and Okta’s Salesforce.com Standard Application using SAML 2.0 protocol
SSO(Single Sign On between Okta(Salesforce.com application) as Identity Provider and Salesforce as Service Provider) Steps to setup SSO between Salesforce and Okta’s Salesforce.com Application:- Go…
Harnessing the Power of Salesforce Health Cloud API: Integration Tips and Tricks
In today's fast-paced healthcare environment, leveraging technology to streamline processes and improve patient care is crucial. Salesforce Health Cloud, with its powerful API capabilities, offers…
The Ultimate Guide to Finding the Right Salesforce Consulting Partner in 2024
Embarking on a Salesforce journey? The selection of the right Salesforce consulting partner can prove a game-changer for you. In this guide, we'll navigate through…
Popular Salesforce Videos
Salesforce Introduction | Salesforce Administrator Tutorial for Beginners
Salesforce Administrators work with stakeholders to define system requirements and customize the platform. To put it simply, they enable users to get the most out…
Discover Lightning Web Components | Salesforce Tutorial
Watch this Salesforce tutorial. After completing this unit, you’ll be able to: Explain the Lightning Web Components programming model. List the benefits of using Lightning…
TrailheaDX '18 Opening Keynote - Part 5: Make Apps Smarter
Related Videos: Salesforce TrailheaDX ’18 Opening Keynote – Part 1: Create Connected Customer Experiences TrailheaDX ’18 Opening Keynote – Part 2: Salesforce Platform TrailheaDX ’18…