You need to sign in to do that
Don't have an account?

how do i write test class for the method that accepts list of record ids.
This is my method :
i have written this test method but it is giving me error of illegal assignment from List to List:
public static List<String> UpdateStatus(List<String> recordId ){ //Fetch the current values in sub status multiselect picklist GPO_Rebate_Payment__c gpopayment = [SELECT Sub_Status__c,Status__c FROM GPO_Rebate_Payment__c where id IN :recordId LIMIT 1]; List<String> currentStatusValues = gpopayment.Sub_Status__c.split(';'); If(gpopayment.Status__c == 'Pharma Payment') { if(!currentStatusValues.Contains('Overdue')) { currentStatusValues.add('Overdue'); } } else{ if(currentStatusValues.Contains('Overdue')) { for(Integer i = currentStatusValues.size() - 1; i >= 0; i--) { if(currentStatusValues[i].equals('Overdue')) { currentStatusValues.remove(i); } } //currentStatusValues.('Overdue'); } /* String newStatusValues; newStatusValues = string.join(currentStatusValues ,';'); gpopayment.Sub_Status__c = newStatusValues;*/ } return currentStatusValues; }
i have written this test method but it is giving me error of illegal assignment from List to List:
@isTest public static void UpdateStatusTest(){ GPO_Rebate_Payment__c gpopayment = new GPO_Rebate_Payment__c(); gpopayment.name = 'test class'; gpopayment.Status__c = 'Pharma Payment'; gpopayment.Sub_Status__c = 'In Progress'; update gpopayment; test.startTest(); List<String> recid = [SELECT Id FROM GPO_Rebate_Payment__c WHERE name='test class']; GPORebatePaymentSubStatusUpdate.UpdateStatusTest(recid.Id); test.stopTest();
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
All Answers
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
but i am getting the following error while running the test class. can u help ?
try with below code. If this helps, Please mark it as best answer.
Thanks!!
If this helps, Please ,mark it as best answer.
Thanks!!