TimeUtil { public static java.time.Instant toJava(Instant timestamp) { return Optional.ofNullable(timestamp) .map(t -> java.time.Instant.ofEpochMilli(t.getMillis())) .orElse(null); } private  TimeUtil(); static java.time.Instant toJava(Instant timestamp); static Instant toJoda(java.time.Instant instant);  }
@Test public void shouldConvertToJavaInstant() { assertThat(TimeUtil.toJava(null)).isNull(); assertThat(TimeUtil.toJava(org.joda.time.Instant.ofEpochMilli(0L))) .isEqualTo(java.time.Instant.ofEpochMilli(0L)); }