122123124125126127128129130131132
return calculateDuration(difference); } private void initTimeUnits() { addUnit(new JustNow()); addUnit(new Millisecond()); addUnit(new Second()); addUnit(new Minute()); addUnit(new Hour()); addUnit(new Day());
139140141142143144145146
t.getUnit((Class<TimeUnit>) null); } @Test public void testGetUnit() { JustNow unit = t.getUnit(JustNow.class); assertNotNull(unit); }
145146147148149150151152153154
assertNotNull(unit); } @Test public void testChangeUnit() { JustNow unit = t.getUnit(JustNow.class); assertEquals(1000L * 60L * 5L, unit.getMaxQuantity()); unit.setMaxQuantity(1); assertEquals(1, t.getUnit(JustNow.class).getMaxQuantity()); }