I have this class
class MyObject {
private LocalDateTime date;
public LocalDateTime getDate() { return this.date; }
public void myMethod() {
this.date = LocalDateTime.now();
}
}
How can I test that the date is properly set? I cannot mock now()
because it is static and if I used LocalDateTime in the test both dates won't be the same.
Aucun commentaire:
Enregistrer un commentaire