private static final DateTimeFormatter DD_MM_YYYY = DateTimeFormatter.ofPattern("dd/MM/yyyy");
public String todayAsString() {
- return formattedToday(LocalDate.now());
+ return format(LocalDate.now());
}
- protected String formattedToday(LocalDate date) {
+ protected String format(LocalDate date) {
return date.format(DD_MM_YYYY);
}
}
return_todays_date_in_dd_MM_yyyy_format() {
ClockGus clock = spy(new ClockGus());
LocalDate today = today();
- given(clock.formattedToday(today)).willReturn(today.format(DD_MM_YYYY));
+ given(clock.format(today)).willReturn(today.format(DD_MM_YYYY));
String date = clock.todayAsString();
assertThat(date, is(today.format(DD_MM_YYYY)));
- verify(clock, times(1)).formattedToday(today);
+ verify(clock, times(1)).format(today);
}
@Test public void
ClockGus clock = new ClockGus();
LocalDate today = today();
- String date = clock.formattedToday(today);
+ String date = clock.format(today);
assertThat(date, is(today.format(DD_MM_YYYY)));
}