function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prem kumar 71prem kumar 71 

How to write test class to the (current date.month)

hi to all,
i am new in salesforce.

how can i write the test class to the below code

   if(currentDate.month() >= 1 && currentDate.month() < 4){
        code
 } else  if(currentDate.month() >= 4 && currentDate.month() < 7){ 
    code 
}



 
Amit Chaudhary 8Amit Chaudhary 8
You can use the Test.IsRunningTest()   in your Apex class.
if(Test.isRunningTest()){
//do something
}
I hope that will help you