### Question:
DailyExpiresHeaderFilter extends AbstractExpiresHeaderFilter { @Override protected void adjustExpires(Calendar next) { if (next.before(Calendar.getInstance())) { next.add(Calendar.DAY_OF_MONTH, 1); } }    }### Answer:
@Test public void testAdjustExpiresPast() throws Exception { Calendar actual = Calendar.getInstance(); actual.set(Calendar.SECOND, 0); actual.set(Calendar.MILLISECOND, 0); Calendar expected = Calendar.getInstance(); expected.setTime(actual.getTime()); expected.add(Calendar.DAY_OF_MONTH, 1); filter.adjustExpires(actual); assertTrue(DateUtils.isSameInstant(expected, actual)); }
@Test public void testAdjustExpiresFuture() throws Exception { Calendar actual = Calendar.getInstance(); actual.add(Calendar.MINUTE, 1); actual.set(Calendar.SECOND, 0); actual.set(Calendar.MILLISECOND, 0); Calendar expected = Calendar.getInstance(); expected.setTime(actual.getTime()); filter.adjustExpires(actual); assertTrue(DateUtils.isSameInstant(expected, actual)); }