-
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
Automate to Upload Files on Amazon S3 Through Salesforce Apex
Amazon S3 is a web service offered by Amazon Web Services. Amazon S3 provides storage through web services interfaces. With the help of the following…
Salesforce Consulting: The Potential of Salesforce Consulting Services
Salesforce Consulting Services is trending due to the fact that they're expanding their support options to a wide variety of customers, meaning they're able to…
Salesforce Interview Questions – Part 1
1. Give me an example of one admin part and one development part which is used in the current organisation. 2. What is the difference between…
Popular Salesforce Videos
5 Things Salesforce Lightning Does Better
In this 30-minute recorded webinar, Jamie Grettum talked about her favorite Lightning features, how to set them up, and how to get hands-on experience with…
Understanding Future Method | Difference Between Asynchronous and Synchronous Apex in Salesforce
In this video, Shrey explained Synchronous Apex and Asynchronous Apex in a simple way. He also explained the importance of the Future method in Salesforce.…
Salesforce: Learn Workflow Rules in Just 10 min
Workflows in Salesforce are a fantastic way to automate certain business processes. You can create a rule, and based on certain criteria that you set,…