@Test
 public void testCeilingInterval() throws Exception {
   Date then = format.parse("5/20/2009");
   Date ref = format.parse("6/17/2009");
   PrettyTime t = new PrettyTime(ref);
   assertEquals("1 month ago", t.format(then));
 }
 @Test
 public void testCeilingInterval() throws Exception {
   Date then = format.parse("20/5/2009");
   Date ref = format.parse("17/6/2009");
   PrettyTime t = new PrettyTime(ref, locale);
   assertEquals("1 maand geleden", t.format(then));
 }
  @Test
  public void testPrettyTimeCenturies() {
    PrettyTime p = new PrettyTime(new Date(3155692597470L * 3L), locale);
    assertEquals("3 eeuwen geleden", p.format(new Date(0)));

    p = new PrettyTime(new Date(0), locale);
    assertEquals("over 3 eeuwen", p.format(new Date(3155692597470L * 3L)));
  }
  @Test
  public void testCustomFormat() throws Exception {
    PrettyTime t = new PrettyTime(new Date(0));
    t.setUnits(
        new TimeUnit() {

          public TimeFormat getFormat() {
            return new BasicTimeFormat()
                .setPattern("%n %u")
                .setRoundingTolerance(20)
                .setFutureSuffix("... RUN!")
                .setFuturePrefix("self destruct in: ")
                .setPastPrefix("self destruct was: ")
                .setPastSuffix(" ago...");
          }

          public long getMaxQuantity() {
            return 0;
          }

          public long getMillisPerUnit() {
            return 5000;
          }

          public String getName() {
            return "tick";
          }

          public String getPluralName() {
            return "ticks";
          }
        });
    assertEquals("self destruct in: 5 ticks ... RUN!", t.format(new Date(25000)));
    t.setReference(new Date(25000));
    assertEquals("self destruct was: 5 ticks ago...", t.format(new Date(0)));
  }
 @Test
 public void testDaysAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3));
   assertEquals("3 days ago", t.format(new Date(0)));
 }
 @Test
 public void testMinutesFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("over 12 minuten", t.format(new Date(1000 * 60 * 12)));
 }
 @Test
 public void testNullDate() throws Exception {
   PrettyTime t = new PrettyTime(locale);
   Date date = null;
   assertEquals("op dit moment", t.format(date));
 }
 @Test
 public void testCenturiesAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(3155692597470L * 3L), locale);
   assertEquals("3 eeuwen geleden", t.format(new Date(0)));
 }
 @Test
 public void testYearsAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(2629743830L * 12L * 3L), locale);
   assertEquals("3 jaar geleden", t.format(new Date(0)));
 }
 @Test
 public void testWeeksAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 7 * 3), locale);
   assertEquals("3 weken geleden", t.format(new Date(0)));
 }
 @Test
 public void testWeeksFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0));
   assertEquals("3 weeks from now", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 3)));
 }
 @Test
 public void testRightNowVariance() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0));
   assertEquals("moments from now", t.format(new Date(600)));
 }
 @Test
 public void testNullDate() throws Exception {
   PrettyTime t = new PrettyTime();
   Date date = null;
   assertEquals("moments from now", t.format(date));
 }
 @Test
 public void testWithinTwoHoursRounding() throws Exception {
   PrettyTime t = new PrettyTime();
   assertEquals("2 hours ago", t.format(new Date(new Date().getTime() - 6543990)));
 }
 @Test
 public void testMonthsAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(2629743830L * 3L));
   assertEquals("3 months ago", t.format(new Date(0)));
 }
 @Test
 public void testMinutesAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(1000 * 60 * 12), locale);
   assertEquals("12 minuten geleden", t.format(new Date(0)));
 }
 @Test
 public void testHoursAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 3), locale);
   assertEquals("3 uur geleden", t.format(new Date(0)));
 }
 @Test
 public void testYearsFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0));
   assertEquals("3 years from now", t.format(new Date(2629743830L * 12L * 3L)));
 }
 @Test
 public void testMonthsAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(2629743830L * 3L), locale);
   assertEquals("3 maanden geleden", t.format(new Date(0)));
 }
 @Test
 public void testCenturiesFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0));
   assertEquals("3 centuries from now", t.format(new Date(3155692597470L * 3L)));
 }
 @Test
 public void testDecadesAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(315569259747L * 3L), locale);
   assertEquals("3 decennia geleden", t.format(new Date(0)));
 }
 @Test
 public void testMonthsFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("over 3 maanden", t.format(new Date(2629743830L * 3L)));
 }
 @Test
 public void testPrettyTime() {
   PrettyTime p = new PrettyTime(locale);
   assertEquals(p.format(new Date()), "op dit moment");
 }
 @Test
 public void testYearsFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("over 3 jaar", t.format(new Date(2629743830L * 12L * 3L)));
 }
 @Test
 public void testDecadesFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("over 3 decennia", t.format(new Date(315569259747L * 3L)));
 }
 @Test
 public void testCenturiesFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("over 3 eeuwen", t.format(new Date(3155692597470L * 3L)));
 }
 @Test
 public void testRightNowVariance() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("op dit moment", t.format(new Date(600)));
 }
 /*
  * Past
  */
 @Test
 public void testMomentsAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(6000), locale);
   assertEquals("een ogenblik geleden", t.format(new Date(0)));
 }
 @Test
 public void testDaysFromNow() throws Exception {
   PrettyTime t = new PrettyTime(new Date(0), locale);
   assertEquals("over 3 dagen", t.format(new Date(1000 * 60 * 60 * 24 * 3)));
 }
 /*
  * Past
  */
 @Test
 public void testMomentsAgo() throws Exception {
   PrettyTime t = new PrettyTime(new Date(6000));
   assertEquals("moments ago", t.format(new Date(0)));
 }