DeadlineTimeoutException extends TimeoutException { public static DeadlineTimeoutException from(final Deadline deadline) { return new DeadlineTimeoutException(deadline); } private  DeadlineTimeoutException(final Deadline deadline); static DeadlineTimeoutException from(final Deadline deadline); Deadline getDeadline();  }
@Test public void testMessage() { final Deadline deadline = Deadline.fromUnixMilliseconds(1000).freeze(); Assert.assertTrue(deadline.toString(), deadline.isExpired()); final String format = deadline.formatTarget(); final TimeValue diff = TimeValue.ofMilliseconds(deadline.remaining()); Assert.assertEquals("Deadline: " + format + ", " + diff + " overdue", DeadlineTimeoutException.from(deadline).getMessage()); }