How to test date created with LocalDateTime.now()
<p>I have this class</p>

<pre><code>class MyObject {
    private LocalDateTime date;

    public LocalDateTime getDate() { return this.date; }

    public void myMethod() {
        this.date = LocalDateTime.now();
    }
}
</code></pre>

<p>How can I test that the date is properly set? I cannot mock <code>now()</code> because it is static and if I used LocalDateTime in the test both dates won't be the same.</p>