So I have a trigger and a schedule class. The trigger will fire upon update on an object and schedule a job which will execute the scheduled class. There is some logic in the trigger related to non-working hours, weekends and holidays. It will usually schedule the job 1 hour after insert (due to business requirement). but if insert happens over the weekend, afterhours, or holidays. It will schedule the next business day 8am.
My problem is my test class does not cover everything. I insert the object in test class, and depends on what time I run the test, it will cover different part. Like if I run during business hours, the weekend, holiday logic doesn't get covered, etc.
My question is there anyway in test class we can set the Datetime.Now to any date and time we want? thanks very much