Skip to content

Instantly share code, notes, and snippets.

@samuel-alves
Last active February 5, 2018 09:59
Show Gist options
  • Save samuel-alves/fe54a6b08723175aa84b6a07cde5c34b to your computer and use it in GitHub Desktop.
Save samuel-alves/fe54a6b08723175aa84b6a07cde5c34b to your computer and use it in GitHub Desktop.
@isTest static void User_can_get_contact_email()
{
// Arrange
System.runAs(createUser())
{
// Act
// Assert
system.assertEquals('contact@place.com', contact.Email, 'Email does not match');
}
}
public static User createUser()
{
Profile profile = [select Id from profile where name = 'Standard User'];
User user = new User(
Alias = 'standard',
Email = 'standarduser@testorg.com',
EmailEncodingKey = 'UTF-8',
LastName = 'Testing',
LanguageLocaleKey = 'en_US',
LocaleSidKey = 'en_GB',
ProfileId = profile.Id,
TimeZoneSidKey = 'Europe/London',
UserName = 'standardusertesting@gearsettest.com'
);
return user;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment