-
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
Introducing Screen Flow in Salesforce
In this Blog, we will learn about Screen Flows. As we all know, flow is an automation tool provided by Salesforce which can be used…
Upcoming Salesforce Events and Releases - 2021
Every year Salesforce comes up with an extravagant and magnificent series of events and 2021 is no different. A lot of exciting events and releases…
Learn Salesforce Einstein – Chapter 2 (AI Buddy Installation)
AI Buddy Installation 1. Login in the org, where you want to install the App. 2. Go to Download Page and click on the latest…
Popular Salesforce Videos
Integrating System with Salesforce Commerce Cloud
Designed for retail as well as eCommerce, Salesforce Commerce Cloud has become the best solution for delivering the ultimate shopping experience to the customers. By…
Salesforce training video for beginners
Salesforce is an innovative tool that can be very powerful when used properly. That’s why it’s important to find effective and trustworthy ways to learn…
What is Salesforce Integration? | Saleforce Integration Explained
Learn how to seamlessly connect different tools and data sources with your Salesforce platform. It's all about making informed decisions and gaining a competitive edge!…