title: Using PowerMockRunner with LocalDate class to mock today's date
body: <p>Consider a <code>DateUtilTest</code> class as follows that uses <code>PowerMockRunner</code>:</p>
  
  <pre><code>import com.reporting.utils.DateUtil;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.powermock.core.classloader.annotations.PrepareForTest;
  import org.powermock.modules.junit4.PowerMockRunner;
  import java.time.LocalDate;
  import java.util.Date;
  
  import static org.junit.Assert.assertEquals;
  import static org.mockito.Mockito.when;
  import static org.powermock.api.mockito.PowerMockito.mockStatic;
  
  @PrepareForTest(DateUtil.class)
  @RunWith(PowerMockRunner.class)
  public class DateUtilTest {
  
  
      @Test
      public void getPreviousWorkingDayAsDate_whenMonday() {
          //given
          LocalDate date = LocalDate.of(2017, 10, 16);
          LocalDate expected = LocalDate.of(2017, 10, 13);
  
          mockStatic(LocalDate.class);
          when(LocalDate.now()).thenReturn(date);
  
          //when
          Date previousWorkingDay = DateUtil.getPreviousWorkingDayAsDate();
  
  
          //then
          assertEquals(DateUtil.getDateFromLocalDate(expected), previousWorkingDay);
      }
  
      @Test
      public void getPreviousWorkingDayAsDate2_whenMonday() {
          //given
          LocalDate date = LocalDate.of(2017, 10, 16);
  
  
          mockStatic(LocalDate.class);
          when(LocalDate.now()).thenReturn(date);
  
          //when
          Date previousWorkingDay = DateUtil.getPreviousWorkingDayAsDate();
          LocalDate expected = LocalDate.of(2017, 10, 13);
  
  
          //then
          assertEquals(DateUtil.getDateFromLocalDate(expected), previousWorkingDay);
      }
  
  }
  </code></pre>
  
  <p>I want to understand why <code>@Test</code> ==>  <code>getPreviousWorkingDayAsDate2_whenMonday</code> fails when I move the <code>expected</code> <code>LocalDate</code> initialization to after the mocking of the <code>LocalDate.class</code>? </p>
  
  <p>Further, could this tests be improved? </p>