Duration { public static Duration hours(Integer hours) { return new Duration(hours * 60 * 60L); } Duration();  Duration(Long seconds); static Duration minutes(Integer minutes); static Duration hours(Integer hours); static Duration seconds(Long seconds); Long asMills(); @Override boolean equals(Object o); @Override int hashCode(); public Long seconds; }
@Test public void hoursCalculation() throws Exception { Duration expectedDuration = hours(24); Duration actualDuration = new Duration(86400L); assertThat(expectedDuration, is(actualDuration)); }