Skip to main content
Anshuman Pratap Singh (Wipro) ha fatto una domanda in #Apex

public List<AggregateResult> inBudgetList {get;set;}

inBudgetList = [SELECT

Budget_User__r.Name inAEName,

Budget_User__c inAeId,

Advertiser__r.Name account,

Sum(Amount__c) inBudAmt,

Broadcast_Month_Date__c effectiveDate

FROM Sales_Budget__c

WHERE Old_Budget_User__c = :selectedUserId

GROUP BY Budget_User__r.Name, Budget_User__c, Advertiser__r.Name, Broadcast_Month_Date__c

ORDER BY Budget_User__r.Name

];

for(AggregateResult inBudItem: inBudgetList){

transferObj.transferUser = (String)inBudItem.get('inAEName');

transferObj.account = (String)inBudItem.get('account');

transferObj.transferIn = (Decimal)inBudItem.get('inBudAmt');

transferObj.transferEffectiveDate = ((Datetime)inBudItem.get('effectiveDate')).format('MMMMM -YYYY');

transferLogs.add(transferObj);

transferObj = new transferLogsWrapper();

This is a part of my code containig aggregate result,please help me in covering this in a test class
13 risposte
  1. 8 mar 2019, 08:37
    Hi Anshuman,

    You need to make changes to the data in test class. Both the fields Old_Budget_User__c and Broadcast_Month_Date__c in the where clause has to be kept in mind.

    Please make sure to pass the data from test class just the way the actual class was expecting in the where clause, it should get covered. You may add debug statements to check if the data is being queried/passed or not and change the test data accordingly.

    Regards,

    Kumar
0/9000