Package org.ocpsoft.prettytime

Examples of org.ocpsoft.prettytime.PrettyTime.format()


  @Test
  public void testHoursAgo() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 3), locale);
    assertEquals("3 tuntia sitten", t.format(new Date(0)));
  }

  @Test
  public void testHoursFromNowSingle() throws Exception
  {
View Full Code Here


  @Test
  public void testHoursFromNowSingle() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    assertEquals("tunnin päästä", t.format(new Date(1000 * 60 * 60 * 1)));
  }

  @Test
  public void testHoursAgoSingle() throws Exception
  {
View Full Code Here

  @Test
  public void testHoursAgoSingle() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 1), locale);
    assertEquals("tunti sitten", t.format(new Date(0)));
  }

  @Test
  public void testDaysFromNow() throws Exception
  {
View Full Code Here

  @Test
  public void testDaysFromNow() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    assertEquals("3 päivän päästä", t.format(new Date(1000 * 60 * 60 * 24 * 3)));
  }

  @Test
  public void testNear2DaysAgo() throws Exception
  {
View Full Code Here

  @Test
  public void testNear2DaysAgo() throws Exception
  {
    int hour = 1000 * 60 * 60;
    PrettyTime t = new PrettyTime(new Date(hour * 24 * 2 - 11*hour), locale);
    assertEquals("2 päivää sitten", t.format(new Date(0)));
    t = new PrettyTime(new Date(hour * 24 * 2 - 13*hour), locale);
    assertEquals("eilen", t.format(new Date(0)));
  }

  @Test
View Full Code Here

  {
    int hour = 1000 * 60 * 60;
    PrettyTime t = new PrettyTime(new Date(hour * 24 * 2 - 11*hour), locale);
    assertEquals("2 päivää sitten", t.format(new Date(0)));
    t = new PrettyTime(new Date(hour * 24 * 2 - 13*hour), locale);
    assertEquals("eilen", t.format(new Date(0)));
  }

  @Test
  public void test3DaysAgo() throws Exception
  {
View Full Code Here

  @Test
  public void test3DaysAgo() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3), locale);
    assertEquals("3 päivää sitten", t.format(new Date(0)));
  }

  @Test
  public void testDaysFromNowSingle() throws Exception
  {
View Full Code Here

  @Test
  public void testDaysFromNowSingle() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    assertEquals("huomenna", t.format(new Date(1000 * 60 * 60 * 24 * 1)));
  }

  @Test
  public void testDaysAgoSingle() throws Exception
  {
View Full Code Here

  @Test
  public void testDaysAgoSingle() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 1), locale);
    assertEquals("eilen", t.format(new Date(0)));
  }

  @Test
  public void testWeeksFromNow() throws Exception
  {
View Full Code Here

  @Test
  public void testWeeksFromNow() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    assertEquals("3 viikon päästä", t.format(new Date(1000 * 60 * 60 * 24 * 7 * 3)));
  }

  @Test
  public void testWeeksAgo() throws Exception
  {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.