How to mock new Date() in java using power mockito : <p>I am currently have a requirement where in, need to mock new Date() to a specific date for all the test cases.</p>

<pre><code>@Before
public void setUp() throws Exception {
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   Date NOW = sdf.parse("2015-09-26 00:00:00");
   whenNew(Date.class).withAnyArguments().thenReturn(NOW);
}
</code></pre>

<p>So i used the above code to mock it , but still when i see the output of the test results, i could still see the actual "new Date()" is executed.</p>

<p>So i added this in @before block in all the test files. So can you please help to know if I am missing anything?</p>
