-
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
Web to Lead Guide: All you Need to Know | Salesforce Guide
Are you still updating the new leads manually on Salesforce or your CRM? Is your Sales team occupied with tasks that are not that fruitful? Stop…
Salesforce Lightning Experience: Main Reasons Why Salesforce Classic is Fading
Introduction "Salesforce Classic is at its Death-End and s going to be okay!" These things are creating a buzz in the online Salesforce Lightning world.…
Implementation of Outlook Integration | Salesforce Step-by-Step Guide
In Salesforce, If you want to set up the outlook Integration. First, you have to know about what is the use of Salesforce integration with…
Popular Salesforce Videos
Prepopulate Field values in Salesforce Lightning Experience Using defaultFieldValues
Prepopulate Field values in Lightning Experience Using defaultFieldValues - Spring 20 This video demonstrates the following items: Set Record Type Id Using defaultFieldValues Enforce User…
Salesforce Pay Expectations $$$ US and UK
Do you agree or disagree with these numbers? How do you think Mason Frank could have surveyed differently? In this video, Brad discusses just how…
How Cyntexa Worked With PointCare To Build Heathcare Application On Salesforce | Client Testimonial
Meet Bart Collins, Director at TEM engineering who used our services for smoother product management by building a Healthcare application on the Salesforce platform. For…