Examples of calculatePreciseDuration()


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

   @Test
   public void testFormattingDurationListInThePast() throws Exception
   {
      PrettyTime t = new PrettyTime(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15 + 1000 * 60 * 38));
      List<Duration> durations = t.calculatePreciseDuration(new Date(0));
      assertEquals("3 days 15 hours 38 minutes ago", t.format(durations));
   }

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

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

   @Test
   public void testFormattingDurationListInTheFuture() throws Exception
   {
      PrettyTime t = new PrettyTime(new Date(0));
      List<Duration> durations = t.calculatePreciseDuration(new Date(1000 * 60 * 60 * 24 * 3 + 1000 * 60 * 60 * 15
               + 1000 * 60 * 38));
      assertEquals("3 days 15 hours 38 minutes from now", t.format(durations));
   }

   @Test
View Full Code Here

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

       PrettyTime prettyTime = new PrettyTime();
       prettyTime.clearUnits();
       Minute minutes = new Minute();
       prettyTime.registerUnit(minutes, new ResourcesTimeFormat(minutes));
       assertEquals("40 minutes ago",
               prettyTime.format(prettyTime.calculatePreciseDuration(new Date(new Date().getTime() - 40*60*1000 - 40*1000))));
   }

   // Method tearDown() is called automatically after every test method
   @After
   public void tearDown() 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.