You need to sign in to do that
Don't have an account?
Need test class for following method
Hi Friends, Thanks in advance
I need test class for following method please any body help me reagrding below code.
Thanks & regards
RohithaSfdc
I need test class for following method please any body help me reagrding below code.
private static void OppLineItemSchedule(Map < Id, Opportunity > oppList) { List < OpportunityLineItem > oppProductLines = [SELECT Station__c, Product_Name__c, Revenue_Category__c, Revenue_Type__c, Quantity__c, OpportunityId, Market__c, PricebookEntryId, UnitPrice, Amount_Input__c, Start_Date__c, End_Date__c, Opportunity.Agency_Commission__c, Opportunity.Synced_Proposal__c FROM OpportunityLineItem WHERE OpportunityId IN: oppList.values() ]; Map < Id, List < OpportunityLineItem >> mapOppLines = new Map < Id, List < OpportunityLineItem >> (); for (OpportunityLineItem oli: oppProductLines) { if (!String.isBlank(oli.Opportunity.Synced_Proposal__c)) { if (mapOppLines.containsKey(oli.Opportunity.Synced_Proposal__c)) { mapOppLines.get(oli.Opportunity.Synced_Proposal__c).add(oli); } else { mapOppLines.put(oli.Opportunity.Synced_Proposal__c, new List < OpportunityLineItem > { oli }); } } } if (mapOppLines.size() > 0) { List<OpportunityLineItem> oliToDelete = new List<OpportunityLineItem>(); for (List<OpportunityLineItem> olis : mapOppLines.values()) oliToDelete.addAll(olis); } }
Thanks & regards
RohithaSfdc
I will advise you to go through below links & create by yourself.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods
Thanks
Anupam
For this method you have to create a map(Id,Opportunity) in your test class & pass that in the method's parameter while calling it in your test class & for the conditional blocks you have to insert those records which fulfill the conditions in your IF blocks otherwise it will not cover the code present in the IF blocks.