title: Mocking DateFormat, SimpleDateFormat, Date class
body: <p>I need to mock the required class(es) and get the desired date result.</p>
  
  <p>I've already tried mocking the format() function in the DateFormat class but didn't work.</p>
  
  <pre><code>class XYZ {
  
     private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss");
     private static final TimeZone UTC = TimeZone.getTimeZone("UTC");
  
     public void buildStr(StringBuilder str){
       DATE_FORMAT.setTimeZone(UTC);
       Date date = getDate();
       str.append(DATE_FORMAT.format(date));
     }
  
     private Date getDate(){
       return new Date();
     }
  
  }
  </code></pre>
  
  <p>In this code I expect the star to be appended with "20190430000000" (exactly this value)
  but I'm getting the current UTC time.</p>