-
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
Learn All About IDs in Salesforce
Ids in Salesforce Hello everyone, In our previous blog we learned about Salesforce in career growth. In this blog, we are about to find out…
How You Can Boost Online Grocery Sales? | Salesforce Help Guide
COVID-19 has accelerated the shift to eCommerce and it is more evident than in the grocery category. Online grocery buyers have increased nearly 30 percent…
Popular Salesforce Videos
How To Use Javascript Editor In Formstack Part 2 - Learn Salesforce Series By Algoworks
Learn how to integrate Javascript editor in Formstack in this Salesforce tutorial brought to you by Algoworks. Did you miss the complete tutorial? To watch…
Wildcards in SOSL | Clauses in SOSL | Learn Salesforce Development
In this video, Shrey covered Wildcards in SOSL in Salesforce. And also you will learn: What are the different Wildcards in SOSL? What are Clauses…
External ID In Salesforce | Salesforce Training
In this video, you will learn how to use External ID in Salesforce, usage, limitations and implementation of External ID in Salesforce. The following points…