예제 #1
0
 public void shouldSerializeAndDeserializeFromJson() throws Exception {
   Duration d = Duration.of("10m");
   ObjectMapper om = new ObjectMapper();
   String ser = om.writeValueAsString(d);
   Duration dd = om.readValue(ser, Duration.class);
   assertEquals(dd, d);
 }
예제 #2
0
 public Range<CalendarDate, ElapsedTime> downTo(CalendarDate date) {
   return to(date, Duration.of().days(-1));
 }
예제 #3
0
 /** {@inheritDoc} */
 @Override
 public CalendarDate previous() {
   return context.getChronology().add(this, Duration.of().days(-1));
 }
예제 #4
0
 public void testOf() {
   assertEquals(Duration.seconds(1), Duration.of("1s"));
   assertEquals(Duration.seconds(1), Duration.of("1 s"));
   assertEquals(Duration.seconds(1), Duration.of("1 second"));
   assertEquals(Duration.seconds(10), Duration.of("10 seconds"));
 }
 @Test(expected = ArithmeticException.class)
 public void plusNanosOnMax2() {
   PlainTimestamp.axis().getMaximum().plus(Duration.of(1, NANOS));
 }