@Test void convertLongMax() { Long result = converter.convert(Instant.MAX); assertEquals(Long.MAX_VALUE, result); }
@Override public Long convert(Instant instant) { if (instant == null) { return null; } if (instant.equals(Instant.EPOCH) || instant.isBefore(Instant.EPOCH)) { return 0L; } if (instant.isAfter(LONG_MAX_INSTANT)) { return Long.MAX_VALUE; } return Math.addExact(Math.multiplyExact(instant.getEpochSecond(), NANOS_PER_SECOND), instant.getNano()); }
InstantToLongConverter implements Converter<Instant, Long> { @Override public Long convert(Instant instant) { if (instant == null) { return null; } if (instant.equals(Instant.EPOCH) || instant.isBefore(Instant.EPOCH)) { return 0L; } if (instant.isAfter(LONG_MAX_INSTANT)) { return Long.MAX_VALUE; } return Math.addExact(Math.multiplyExact(instant.getEpochSecond(), NANOS_PER_SECOND), instant.getNano()); } }
InstantToLongConverter implements Converter<Instant, Long> { @Override public Long convert(Instant instant) { if (instant == null) { return null; } if (instant.equals(Instant.EPOCH) || instant.isBefore(Instant.EPOCH)) { return 0L; } if (instant.isAfter(LONG_MAX_INSTANT)) { return Long.MAX_VALUE; } return Math.addExact(Math.multiplyExact(instant.getEpochSecond(), NANOS_PER_SECOND), instant.getNano()); }  }
InstantToLongConverter implements Converter<Instant, Long> { @Override public Long convert(Instant instant) { if (instant == null) { return null; } if (instant.equals(Instant.EPOCH) || instant.isBefore(Instant.EPOCH)) { return 0L; } if (instant.isAfter(LONG_MAX_INSTANT)) { return Long.MAX_VALUE; } return Math.addExact(Math.multiplyExact(instant.getEpochSecond(), NANOS_PER_SECOND), instant.getNano()); }  @Override Long convert(Instant instant); }
InstantToLongConverter implements Converter<Instant, Long> { @Override public Long convert(Instant instant) { if (instant == null) { return null; } if (instant.equals(Instant.EPOCH) || instant.isBefore(Instant.EPOCH)) { return 0L; } if (instant.isAfter(LONG_MAX_INSTANT)) { return Long.MAX_VALUE; } return Math.addExact(Math.multiplyExact(instant.getEpochSecond(), NANOS_PER_SECOND), instant.getNano()); }  @Override Long convert(Instant instant); static final InstantToLongConverter INSTANCE; static final Instant LONG_MAX_INSTANT; }