Package org.ocpsoft.prettytime

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


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

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


  @Test
  public void testMillenniumFromNow() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    assertEquals("vuosituhannen päästä", t.format(new Date(1000L * 60 * 60 * 24 * 365 * 1001)));
  }

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

  @Test
  public void testMillenniumAgo() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(1000L * 60 * 60 * 24 * 365 * 1001), locale);
    assertEquals("vuosituhat sitten", t.format(new Date(0)));
  }

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

  @Test
  public void testFormattingDurationListInThePast() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15 + 1000 * 60 * 38), locale);
    List<Duration> durations = t.calculatePreciseDuration(new Date(0));
    assertEquals("3 päivää 15 tuntia 38 minuuttia sitten", t.format(durations));
  }

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

  public void testFormattingDurationListInTheFuture() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    List<Duration> durations = t.calculatePreciseDuration(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15
        + 1000 * 60 * 38));
    assertEquals("3 päivän 15 tunnin 38 minuutin päästä", t.format(durations));
  }


}
View Full Code Here

  @Test
  public void testRightNow() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(0), locale);
    assertEquals("hetken päästä", t.format(new Date(6000)));
  }

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

  @Test
  public void testMomentsAgo() throws Exception
  {
    PrettyTime t = new PrettyTime(new Date(6000), locale);
    assertEquals("hetki sitten", t.format(new Date(0)));
  }
 
  @Test
  public void testMilliSecondsFromNow() throws Exception
  {
View Full Code Here

 
  @Test
  public void testMilliSecondsFromNow() throws Exception
  {
    PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale);
    assertEquals("13 millisekunnin päästä", t.format(new Date(13)));
  }

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

  @Test
  public void testMilliSecondsAgo() throws Exception
  {
    PrettyTime t = newPrettyTimeWOJustNow(new Date(13), locale);
    assertEquals("13 millisekuntia sitten", t.format(new Date(0)));
  }

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

  @Test
  public void testMilliSecondFromNow() throws Exception
  {
    PrettyTime t = newPrettyTimeWOJustNow(new Date(0), locale);
    assertEquals("millisekunnin päästä", t.format(new Date(1)));
  }

  @Test
  public void testMilliSecondAgo() 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.