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); }
public Range<CalendarDate, ElapsedTime> downTo(CalendarDate date) { return to(date, Duration.of().days(-1)); }
/** {@inheritDoc} */ @Override public CalendarDate previous() { return context.getChronology().add(this, Duration.of().days(-1)); }
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)); }