I'm trying to write a unit test for my Timeline apex class but I keep getting an error: "Compilation error: Constructor not defined:[Timeline].<Constructor>".
@isTest public class TimelineTest { public static testMethod void testTimeline() { Test.startTest(); Participant__c participant = new Participant__c(); participant.First_Name__c = 'test'; participant.Last_Name__c = 'user'; participant.Client_Id__c = '1101'; participant.DOB__c = Date.newInstance(1976,1,1); insert participant; Timeline t = new Timeline(); t.pid = participant.Id; t.violations; Test.stopTest(); } }
My Timeline class looks like this:
public class Timeline { public String pid {get;set;} public Timeline(ApexPages.StandardController controller) { pid = ApexPages.currentPage().getParameters().get('Id'); violations = JSON.serialize( Database.query('SELECT...') ); } }