I have a catch-22 issue that I have been unable to test fully. I am using a W2L form to input lead information remotely and its well documented that using an email field can cause the record to fail to insert since internal salesforce validation seems to happen before the record is sent to the trigger.
TestMe test = new TestMe(); test.initializeLead(false); test.lead.email = 'i will break'; insert test.lead;
12:42:28.494 (1494981000)|FATAL_ERROR|System.DmlException: Insert failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Email: invalid email address: i will break: [Email]
so I'm asking someone to confirm whether or not this is a the case of an un-testable situation where we cannot insert a lead with an invalid email from a unit test but can have the case where an email can be custom validated through a trigger or validation when inserted through W2L?