public static Deadline fromDelay(
        Time time,
        long delay,
        TimeUnit timeUnit
    ) {
        if (delay < 0) {
            throw new RuntimeException("Negative delays are not allowed.");
        }
        long nowNs = time.nanoseconds();
        BigInteger deadlineNs = BigInteger.valueOf(nowNs).
                add(BigInteger.valueOf(timeUnit.toNanos(delay)));
        if (deadlineNs.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) >= 0) {
            return new Deadline(Long.MAX_VALUE);
        } else {
            return new Deadline(deadlineNs.longValue());
        }
    }
@Test
    public void testNegativeDelayFails() {
        assertEquals("Negative delays are not allowed.",
            assertThrows(RuntimeException.class,
                () -> Deadline.fromDelay(monoTime(123456789L), -1L, MILLISECONDS)).
                    getMessage());
    }