Skip to main content
Sudhir Narayanaswamy ha fatto una domanda in #Apex
Hi, 

  I have a below helper class which is geting called inside trigger please sugggest me how to write test class for this helper class

 

public with sharing class RenewalUtils {

public static String OppLineDisc(String QOppID, String Quoteid, String ProdCode) {

Decimal Disctot;

Opportunity ropp = [select Prior_Year_Opportunity__c from opportunity where id = :QOppID and recordtype.name = 'Renewal Opportunity'];

List<AggregateResult> Opplst = [select avg(Discount_Percent__c) totdisc

from OpportunityLineItem

where Opportunityid = :ropp.Prior_Year_Opportunity__c and

product2.productcode = :ProdCode

];

for (AggregateResult arOpplst : Opplst)

{

Disctot = ((Decimal)arOpplst.get('totdisc'));

}

system.debug(Disctot);

return string.valueof(Disctot);

}

public static String OppLineID(String QOppID, String Quoteid, String ProdCode) {

Opportunity ropp = [select Prior_Year_Opportunity__c from opportunity where id = :QOppID and recordtype.name = 'Renewal Opportunity'];

OpportunityLineItem Opplst = [select id

from OpportunityLineItem

where Opportunityid = :ropp.Prior_Year_Opportunity__c and

product2.productcode = :ProdCode limit 1

];

system.debug(Opplst.id);

return string.valueof(Opplst.id);

}

}

Thanks

Sudhir
6 risposte
  1. 1 mar 2017, 04:34
    I ran your code I get message below mesage when I click on run class Please suggest me what might be the issue. 

    Selected job is not yet complete.

     
0/9000