### Question:
MonthlyExpiresHeaderFilter extends AbstractExpiresHeaderFilter { @Override protected void doActivate(ComponentContext context) throws Exception { super.doActivate(context); @SuppressWarnings("unchecked") Dictionary<String, Object> props = context.getProperties(); dayOfMonth = PropertiesUtil.toString(props.get(PROP_EXPIRES_DAY_OF_MONTH), null); if (StringUtils.isBlank(dayOfMonth)) { throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH, "Day of month must be specified."); } if (!StringUtils.equalsIgnoreCase(LAST, dayOfMonth)) { try { int intDay = Integer.parseInt(dayOfMonth); Calendar test = Calendar.getInstance(); if (intDay < test.getMinimum(Calendar.DAY_OF_MONTH)) { throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH, "Day of month is smaller than minimum allowed value."); } if (intDay > test.getActualMaximum(Calendar.DAY_OF_MONTH)) { throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH, "Day of month is larger than least maximum allowed value."); } } catch (NumberFormatException ex) { throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH, "Day of month is not a valid value."); } } }    }### Answer:
@Test(expected = ConfigurationException.class) public void testDoActivateCallsParent() throws Exception { properties.remove(MonthlyExpiresHeaderFilter.PROP_EXPIRES_TIME); filter.doActivate(componentContext); }
@Test(expected = ConfigurationException.class) public void testDoActivateNoDayOfMonth() throws Exception { filter.doActivate(componentContext); }
@Test(expected = ConfigurationException.class) public void testDoActivateInvalidLowDayOfMonth() throws Exception { properties.put(MonthlyExpiresHeaderFilter.PROP_EXPIRES_DAY_OF_MONTH, 0); filter.doActivate(componentContext); }
@Test(expected = ConfigurationException.class) public void testDoActivateInvalidHighDayOfMonth() throws Exception { Calendar test = Calendar.getInstance(); int val = test.getActualMaximum(Calendar.DAY_OF_MONTH) + 1; properties.put(MonthlyExpiresHeaderFilter.PROP_EXPIRES_DAY_OF_MONTH, val); filter.doActivate(componentContext); }