I'm taking a stab at setting up unit tests for some utility classes in a project I'm working on, and one of the classes has a method that does some determination based on the current time.
public String firstDay() {
Date dateDuJour = new Date();
int jourCourant = dateDuJour.getDate();
if (jourCourant == 1)
return "firstDay";
else
return "otherDay";
}
How can I solve the problem of unit test a method that is used, the term new Date ()?
Edit
I would not modify working code in order to get a better Cobertura result, or to make sure something can pass a unit test.