Temporals { public static Duration max(Duration d1, Duration d2) { return d1.compareTo(d2) == 1 ? d1 : d2; }  static Duration max(Duration d1, Duration d2); static Duration min(Duration d1, Duration d2);  }
@Test public void maxHandlesSameUnit() { Duration hundredMillis = Duration.ofMillis(100); Duration thousandMillis = Duration.ofMillis(1000); assertThat(Temporals.max(hundredMillis, thousandMillis)).isEqualTo(thousandMillis); }
@Test public void maxHandlesDifferentUnits() { Duration sixtyOneMinutes = Duration.ofMinutes(61); Duration oneHour = Duration.ofHours(1); assertThat(Temporals.max(sixtyOneMinutes, oneHour)).isEqualTo(sixtyOneMinutes); }
@Test public void maxHandlesEqualValue() { Duration oneMilli = Duration.ofMillis(1); Duration oneMillionNanos = Duration.ofNanos(1_000_000); assertThat(Temporals.max(oneMilli, oneMillionNanos)).isEqualTo(oneMilli); assertThat(Temporals.max(oneMilli, oneMillionNanos)).isEqualTo(oneMillionNanos); }