Conversation
… issues in LeadTrigger and LeadTriggerHandler
…Fixed issue in LeadTriggerHandler
walters954
left a comment
There was a problem hiding this comment.
Excellent. I added some areas for practice. In your negative test cases try adding special characters as well.
| if ( | ||
| ld.title.containsIgnoreCase('vp') || | ||
| ld.title.containsIgnoreCase('v.p.') || | ||
| ld.title.containsIgnoreCase('vice president') | ||
| ) { | ||
| ld.Title = 'Vice President'; | ||
| } else if ( | ||
| ld.title.contains('mgr') || | ||
| ld.title.contains('manage') || | ||
| ld.title.contains('head of department') | ||
| ld.title.containsIgnoreCase('mgr') || | ||
| ld.title.containsIgnoreCase('manage') || | ||
| ld.title.containsIgnoreCase('head of department') | ||
| ) { | ||
| ld.Title = 'Manager'; | ||
| } else if (ld.title.contains('exec') || ld.title == 'chief' || ld.title.contains('head')) { | ||
| } else if ( | ||
| ld.title.containsIgnoreCase('exec') || | ||
| ld.title.containsIgnoreCase('chief') || | ||
| ld.title.containsIgnoreCase('head') | ||
| ) { | ||
| ld.Title = 'Executive'; | ||
| } else if (ld.title.contains('assist') || ld.title.contains('deputy') || ld.title == 'jr') { | ||
| } else if ( | ||
| ld.title.containsIgnoreCase('assist') || | ||
| ld.title.containsIgnoreCase('deputy') || | ||
| ld.title.containsIgnoreCase('jr') |
There was a problem hiding this comment.
For all of these examples try create a contains the values that you are looking for then do contain on the list.
| if (ld.LeadSource == 'Web' && ld.Email != null) { | ||
| score += 3; | ||
| } |
There was a problem hiding this comment.
Put the condition values into a variable so it's easier to change in the future.
| * @param name The name value for the Account | ||
| * @param doInsert Set true to insert new created records to the database | ||
| */ | ||
| public static Account getAccount(String name, Boolean doInsert) { |
There was a problem hiding this comment.
I would rename this to generateAccount
There was a problem hiding this comment.
consistently, your method name would make this flow better. Overall this is really good.
| * @param params The map that contains pairs of fieldName/value | ||
| * @param doInsert Set true to insert new created records to the database | ||
| */ | ||
| public static List<Lead> createLeadsWithParams(Integer numLeads, Map<String, Object> params, Boolean doInsert) { |
There was a problem hiding this comment.
Add additional test directly testing method like LeadTriggerHandler.handleTitleNormalization
Passing in the leads you create in memory.
👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to
mainsince the assignment started. Your teacher can see this too.Notes for teachers
Use this PR to leave feedback. Here are some tips:
mainsince the assignment started. To leave comments on specific lines of code, put your cursor over a line of code and click the blue + (plus sign). To learn more about comments, read “Commenting on a pull request”.main. Click a commit to see specific changes.For more information about this pull request, read “Leaving assignment feedback in GitHub”.
Subscribed: @ManoolK