
Hii Christopher Try Below test Class
Please Mark It As Best Answer If It Helps@isTest
public class TestTaskTriggers {
@isTest
public static void unitTest(){
Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator'];
User usr = new User(LastName = 'sample',
FirstName='sam',
Alias = 'simplSam',
Email = 'ssamsimple@asdf.com',
Username = 'ssamsimple@asdf.com',
ProfileId = p.id,
TimeZoneSidKey = 'GMT',
LanguageLocaleKey = 'en_US',
EmailEncodingKey = 'UTF-8',
LocaleSidKey = 'en_US'
);
insert usr;
system.runAs(usr){
Test.startTest();
Account acc = new Account();
acc.name='Test Account';
insert acc;
Trial__c trial = new Trial__c (Name = 'Test', Matter__c='a172h000001FLYZAA4');
insert trial;
Task tsk = new Task();
tsk.Subject = trial.Name + ' Test Task';
tsk.Type = 'Email';
tsk.Task_Reference__c = 'L-739-5';
tsk.ActivityDate = System.today().addMonths(1);
tsk.Description = 'Test Task';
tsk.OwnerId = usr.Id;
tsk.WhatId = acc.Id;
insert tsk;
task.Status='Completed';
update task;
Test.stopTest();
}
}
}
Thank You!