@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Duration)) { return false; } Duration that = (Duration)other; return this.days == that.getDays() && this.hours == that.getHours() && this.minutes == that.getMinutes() && this.seconds == that.getSeconds() && this.milliseconds == that.getMilliseconds(); }
private static void verify(Duration duration, long expectedDays, int expectedHours, int expectedMinutes, int expectedSeconds, int expectedMilliseconds, String expectedString) { assertEquals(expectedString, duration.toString()); assertEquals(expectedDays, duration.getDays()); assertEquals(expectedHours, duration.getHours()); assertEquals(expectedMinutes, duration.getMinutes()); assertEquals(expectedSeconds, duration.getSeconds()); assertEquals(expectedMilliseconds, duration.getMilliseconds()); }