Code calling LocalDate.now() directly becomes impossible to test reliably around midnight or leap years. Injecting java.time.Clock makes time deterministic in tests, while DateTimeFormatter replaces unsafe SimpleDateFormat everywhere.
More lessons in Complete Core Java