@isTest
public class UnitTests_CreateNewTask10 {
static testMethod void CreateNewTask10() {
public class UnitTests_CreateNewTask10 {
static testMethod void CreateNewTask10() {
//Set up user
User u1 = [SELECT Id FROM User WHERE Alias='auser'];
test.startTest();
//Run As U1
System.RunAs(u1){
Lead l = new Lead(
FirstName='Test firstName',
LastName = 'Test LastName',
Comments__c = '18888 test comments'
);
insert l;
System.debug('Created and inserted lead');
List<Task> tasks = new List<Task>();
tasks.add(new Task(
ActivityDate = Date.today().addDays(7),
WhoId = l.Id,
Status = 'Not Started',
type='Other',
Priority='Normal',
Subject='trigger add New Comment',
Description = l.Comments__c
));
insert tasks;
System.debug('Created and inserted task');
Task Ttest = [SELECT Whoid, Description FROM Task WHERE Whoid=:l.Id Limit 1];
system.assertEquals('18888 test comments', Ttest.Description);
test.stopTest();
} //end RunAs(u1)
}
}
}
}