-
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
Salesforce declares a new Content Management System
Salesforce announced a new tool named Salesforce Content Management System recently which is designed in an optimized manner to deliver a quality customer experience across multiple channels. The…
Learn All About Salesforce Hyperforce
Developing a working relationship with customers is critical to a company's long-term success. A strong connection built on trust and communication makes customers feel more…
How to Connect Salesforce and Postman Using SOAP API
SOAP APIs are developed as the intermediate language. In simple words, we can say that if you built an app in different languages and you…
Popular Salesforce Videos
Salesforce Resume Review
Salesforce is a well-known company and leader in the cloud computing space so we would say it would be an asset on a resume. Thinking…
Mastering Apex Collections | Salesforce Tutorial
Working with collections like List, Map and Set is part of the day’s routine for Apex developers. While their basic use is straightforward, there are…
Spring '21 Release - Time-dependent Action in Salesforce Flows
If you’re familiar with scheduled actions in Process Builder or time-dependent actions in workflow rules, know that scheduled paths on record-triggered flows can accomplish the…