TDD - how to test time-based functionality without implementing it within the test?
<p>I'm trying out TDD on some side project and already encountered this a couple of times.<br>
As an example, my program needs to take a number X, and find out the date string that was X days ago, in order to perform certain date-based queries.<br>
So I figured I need a test that validates the date computation is correct.
But, since the test depends on the current date, how can create such a test?<br>
I can have the test method implement this exact functionality by itself, but that would just make it redundant...</p>

<p>Edit: I've seen <a href="https://stackoverflow.com/questions/17229525/setting-time-and-date-in-junit-test-fixture">Setting time and date in JUnit test fixture</a> but the answers there seem quite an overkill to what I was trying to achieve.</p>