-
How I can create a code coverage for my code that has many conditions (not for b
Hi, how I can create a code coverage for my code that has many conditions (not for boolean).
Here is my code:
public with sharing class LCC_App_rej_Return_shipment_cApex {
@AuraEnabled
public static void submitFinalApproval(Id recordId) {
//1. RS
if(String.valueOf(recordId).startsWith('a0O')){
update new Return_Shipment__c(Id = recordId, Final_Approved__c = true);
}
//2. VO__c
if(String.valueOf(recordId).startsWith('a0G')){
update new VO__c(Id = recordId, Final_Approved__c = true);
}
//3. RPR__c
if(String.valueOf(recordId).startsWith('a0A')){
update new RPR__c(Id = recordId, Final_Approved__c = true);
}
//4. gProposal__c
if(String.valueOf(recordId).startsWith('a0K')){
update new gProposal__c(Id = recordId, Final_Approved__c = true);
}
//5. Order_Cancellation_Re__c
if(String.valueOf(recordId).startsWith('a0L')){
update new Order_Cancellation_Re__c(Id = recordId, Final_Approved__c = true);
}
//6. Payment_Term_Credit_Limit__c
if(String.valueOf(recordId).startsWith('a0N')){
update new Payment_Term_Credit_Limit__c(Id = recordId, Final_Approved__c = true);
}
//7. Credit_Facility__c
if(String.valueOf(recordId).startsWith('a0R')){
update new Credit_Facility__c(Id = recordId, Final_Approved__c = true);
}
//8. Sample_Request_Form__c
if(String.valueOf(recordId).startsWith('a0T')){
update new Sample_Request_Form__c(Id = recordId, Final_Approved__c = true);
}
//9. Technical_Documents_Request_Form__c
if(String.valueOf(recordId).startsWith('a0S')){
update new Technical_Documents_Request_Form__c(Id = recordId, Final_Approved__c = true);
}
//10. Costing_Request_List__c
if(String.valueOf(recordId).startsWith('a0P')){
update new Costing_Request_List__c(Id = recordId, Final_Approved__c = true);
}
//11. MDR_Declaration_Form__c
if(String.valueOf(recordId).startsWith('a0V')){
update new MDR_Declaration_Form__c(Id = recordId, Final_Approved__c = true);
}
//12. SAF__c
if(String.valueOf(recordId).startsWith('a0B')){
update new SAF__c(Id = recordId, Final_Approved__c = true);
}
}
@AuraEnabled
public static void submitFinalApprovalNo(Id recordId) {
//1. RS
if(String.valueOf(recordId).startsWith('a0O')){
update new Return_Shipment__c(Id = recordId, Final_Approved__c = false);
}
//2. VO__c
if(String.valueOf(recordId).startsWith('a0G')){
update new VO__c(Id = recordId, Final_Approved__c = false);
}
//3. RPR__c
if(String.valueOf(recordId).startsWith('a0A')){
update new RPR__c(Id = recordId, Final_Approved__c = false);
}
//4. gProposal__c
if(String.valueOf(recordId).startsWith('a0K')){
update new gProposal__c(Id = recordId, Final_Approved__c = false);
}
//5. Order_Cancellation_Re__c
if(String.valueOf(recordId).startsWith('a0L')){
update new Order_Cancellation_Re__c(Id = recordId, Final_Approved__c = false);
}
//6. Payment_Term_Credit_Limit__c
if(String.valueOf(recordId).startsWith('a0N')){
update new Payment_Term_Credit_Limit__c(Id = recordId, Final_Approved__c = false);
}
//7. Credit_Facility__c
if(String.valueOf(recordId).startsWith('a0R')){
update new Credit_Facility__c(Id = recordId, Final_Approved__c = false);
}
//8. Sample_Request_Form__c
if(String.valueOf(recordId).startsWith('a0T')){
update new Sample_Request_Form__c(Id = recordId, Final_Approved__c = false);
}
//9. Technical_Documents_Request_Form__c
if(String.valueOf(recordId).startsWith('a0S')){
update new Technical_Documents_Request_Form__c(Id = recordId, Final_Approved__c = false);
}
//10. Costing_Request_List__c
if(String.valueOf(recordId).startsWith('a0P')){
update new Costing_Request_List__c(Id = recordId, Final_Approved__c = false);
}
//11. MDR_Declaration_Form__c
if(String.valueOf(recordId).startsWith('a0V')){
update new MDR_Declaration_Form__c(Id = recordId, Final_Approved__c = false);
}
//12. SAF__c
if(String.valueOf(recordId).startsWith('a0B')){
update new SAF__c(Id = recordId, Final_Approved__c = false);
}
}}
Kindly help. The coverage not necessary 100%. 75%, and above already ok
Log In to reply.
Popular Salesforce Blogs
5 Ways to Speed Up Your Non-profit Business | Salesforce Guide
Mission, communication, and motivation are the three pillars of success for non-profit organizations. According to NonProfitPRO, these three steps help charities achieve their goals. First,…
Top Tools and Streamlining Government Services with Public Sector Cloud
The march of technology has dramatically changed how government services are delivered, with ever more efficiency and accessibility. One of the most influential innovations driving…
Object Level Security in Salesforce | The Salesforce Security Guide
We may provide access to an item in Salesforce at the profile or permissions set level. From the Profile or Permission set level, you may…
Popular Salesforce Videos
Set Up a Microsoft Exchange Service Account to Sync with Salesforce (Using Command Shell)
You can sync sales reps’ contacts and events between your Microsoft Exchange-based email and Salesforce using the Salesforce feature Lightning Sync. If you’re an Exchange…
How the Salesforce Ecosystem Helped My Career
Welcome back to 100DaysofTrailhead.com! Your involvement in the Salesforce Ecosystem can be a great boost to your career. In this video, Eric talks about the…
Marc Benioff on How Salesforce Was Able To "do well and do good"
Billionaire Marc Benioff is considered a game-changer for activism in the business world. Benioff is the co-CEO, chairman, and co-founder of the cloud computing company…