Calendar date = Calendar.getInstance();
date.setTime(dateFormat.parse(dateString));
DateFunction dateFunction = mock(DateFunction.class);
when(dateFunction.generateValue()).thenReturn(date);
DateAsStringFunction dateAsStringFunction = new DateAsStringFunction(dateFunction, pattern);
assertEquals(dateString, dateAsStringFunction.generateValue());
}