@Test
  public void shouldReturnFormattedDateWhenDataValue() throws Exception {

    WebDataBinder dataBinder = new WebDataBinder(null);
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String dateString = "2015-10-01 12:00:00";
    Date value = dateFormat.parse(dateString);

    controller.initBinder(dataBinder);
    CustomDateEditor editor = (CustomDateEditor) dataBinder.findCustomEditor(Date.class, null);
    editor.setValue(value);
    String parsedDate = editor.getAsText();
    assertThat(dateString, is(parsedDate));
  }