Created
September 14, 2019 20:20
-
-
Save jaspreetsidhu/020cb6e11fefd8c1280b44cb2e00e38d to your computer and use it in GitHub Desktop.
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
@isTest | |
public class TestRestrictContactByName{ | |
@isTest static void testRestrictContactByName () { | |
Contact c = new Contact(LastName='INVALIDNAME'); | |
try{ | |
insert c; | |
} | |
catch(DMLException e){ | |
System.assert(e.getMessage().contains('The Last Name "'+c.LastName+'" is not allowed for DML')); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment