@Test public void testFormatTwoDaysAgo() { String expected = "2 days ago"; int nDays = 2; when(translationService.format(LibraryConstants.DaysAgo, nDays)).thenReturn(expected); String actual = dateUtils.format(createDateFromNow(nDays)); assertEquals(expected, actual); }
public String format(Date date) { int diffInDays = diffInDaysFromNow(date); if (diffInDays < SEVEN_DAYS) { return formatInDays(diffInDays); } else { return formatInWeeks(diffInDays); } }
DateUtils { public String format(Date date) { int diffInDays = diffInDaysFromNow(date); if (diffInDays < SEVEN_DAYS) { return formatInDays(diffInDays); } else { return formatInWeeks(diffInDays); } } }
DateUtils { public String format(Date date) { int diffInDays = diffInDaysFromNow(date); if (diffInDays < SEVEN_DAYS) { return formatInDays(diffInDays); } else { return formatInWeeks(diffInDays); } } @Inject  DateUtils(TranslationService translationService); }
DateUtils { public String format(Date date) { int diffInDays = diffInDaysFromNow(date); if (diffInDays < SEVEN_DAYS) { return formatInDays(diffInDays); } else { return formatInWeeks(diffInDays); } } @Inject  DateUtils(TranslationService translationService); String format(Date date); }
DateUtils { public String format(Date date) { int diffInDays = diffInDaysFromNow(date); if (diffInDays < SEVEN_DAYS) { return formatInDays(diffInDays); } else { return formatInWeeks(diffInDays); } } @Inject  DateUtils(TranslationService translationService); String format(Date date); static final int ONE_DAY_IN_MS; }