How to override/control the way the JVM gets the system date?

Posted by Abel Morelos on Stack Overflow See other posts from Stack Overflow or by Abel Morelos
Published on 2010-03-30T21:34:02Z Indexed on 2010/03/30 21:43 UTC
Read the original article Hit count: 424

Filed under:
|
|
|

How do you mock-up/trick the JVM to get a date other that the current system date? I have a set of tests in JUnit I don't want to change, but instead I want to change a setting so that when the JVM retrieves the date it retrieves the date I want.

Have you done something similar before?

Thanks.

© Stack Overflow or respective owner

Related posts about junit

Related posts about unit-testing