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

method does not exist / incorrect signature
I have a similar issue to this posting here, although I'm still not able to figure out what's causing this error to show up:
I've written a method that takes a list of leads, iterates across it and changes certain fields, updates the appropraite records, then returns the list.
public with sharing class LeadUpdate { public static List<Lead> changeSource(List<Lead> boxlist){ for(lead a:boxlist){ if (a.Source_Detail_Most_Recent__c == '??') { a.Source_Detail__c = ''; a.LeadSource = 'REP NEEDS TO ASK'; } try {update boxlist;} catch ( System.DmlException e) { system.assert(e.getMessage().contains('irst error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A lead with this email address already exists'), e.getMessage()); } return boxlist; } }
I'll be activating this through a VF page, so my idea is just to pass a list that is populated by a SQL query into the above method. However, when testing this method (there are actually ~100 if statements, though I'm just testing on the first one for now) I'm running into this error:
"Method does not exist or incorrect signature: LeadUpdate.chagneSource(List<Lead>)
My test looks like this:
@isTest private class LeadUpdateTest { private static testmethod void updatetest(){ List<Lead> boxlist = new List<Lead>(); for(integer j = 0; j < 10; j++){ lead a = new lead (LastName = 'test' + j, Source_Detail__c = '??', LeadSource = ''); boxlist.add(a); } insert boxlist; LeadUpdate lu = new LeadUpdate(); List<Lead> testolist = null; testolist = LeadUpdate.changeSource(boxlist); for(lead a: testolist){ system.assertEquals('', a.Source_Detail__c); system.assertEquals('REP NEEDS TO ASK', a.LeadSource); } } }
any ideas? thank you all!
Try this