Last active
May 19, 2020 09:49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BulkInsertProfiler extends LimitsProfiler { | |
private List<String> fieldsToCheck; | |
transient Savepoint sp = null; | |
List<Contact> c; | |
public BulkInsertProfiler() { } | |
public override void setup() { | |
sp = Database.setSavepoint(); | |
c = new List<Contact>(); | |
for(integer i = 0; i<200;i++) { | |
c.add(sampleContact(i)); | |
} | |
fieldsToCheck = new List<String>{'LastName','FirstName','Salutation','OtherStreet','OtherCity','OtherState','OtherPostalCode','OtherCountry','OtherLatitude','OtherLongitude','MailingStreet','MailingCity','MailingState','MailingPostalCode','MailingCountry','MailingLatitude','MailingLongitude','Phone','Fax','MobilePhone','HomePhone','OtherPhone','AssistantPhone','ReportsToId','Title','Department','AssistantName','LeadSource','Birthdate','Description','EmailBouncedReason','EmailBouncedDate', 'Email'}; | |
} | |
public override void execute() { | |
System.assertNotEquals(null, fieldsToCheck); | |
ESAPI.accessController().insertAsUser(c, fieldsToCheck); | |
} | |
public override void tearDown() { | |
Database.rollback(sp); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment