-
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
Visualforce Pages in Salesforce | The Developer Guide
Visualforce Page In Salesforce Visualforce Page is just like HTML, i.e, It is a tag-based markup language. It allows developers to build sophisticated, user-custom interfaces.…
Salesforce for Energy and Utility Sector for Adapting to New Customer Expectations
Energy and utility companies are known to have contingency plans to remain stable in any uncertain situation. And that’s where digitization has helped such companies…
Unit Testing on Salesforce Lightning Platform | Quick Guide
Before we begin, we have to know about unit testing i.e. what is unit testing and why do we test the code? All that stuff…
Popular Salesforce Videos
QuickBooks Salesforce Connector | Setup & Configuration
QuickBooks Salesforce Connector: https://eshopsync.com/quickbooks/ is taking the cloud-based platforms to the new altitudes. Now dealing with QuickBooks unlimited data is much easier than ever before.…
Introducing the New gRPC-based Pub Sub API | Salesforce Developer Quick Takes
Learn about the Pub Sub API, a new gRPC-based API that exposes the power of the Salesforce Event Bus. Discover the technology, its use cases,…
Can a Housewife Make Career in Salesforce?
Wondering if a Housewife can make a career in Salesforce Join this user group for Salesforce job & career info and learn all you need…