You need to sign in to do that
Don't have an account?
Andrew Hoban 6
Unable to cover System.Today() in a test class
Hi,
I have a trigger that uses system.today() in multiple if statements.
I am having difficuly trying to cover this in my test class. One of the statements checks if the current month is either July or August. As im currently testing this in January, it will not be covered.
What is the best way to dynamically cover this scenario?
Thanks,
Trigger (Currnent month is Janurary)
I have a trigger that uses system.today() in multiple if statements.
I am having difficuly trying to cover this in my test class. One of the statements checks if the current month is either July or August. As im currently testing this in January, it will not be covered.
What is the best way to dynamically cover this scenario?
Thanks,
Trigger (Currnent month is Janurary)
if(System.today().Month() == 7 || System.today().Month() == 8){ }
in test
Maybe it helps you.
All Answers
in test
Maybe it helps you.