### Question:
ConfigurableAgeOffFilter extends Filter implements OptionDescriber { @Override public boolean validateOptions(Map<String,String> options) { try { Integer.parseInt(options.get(AgeOffConfigParams.TTL)); } catch (NumberFormatException nfe) { log.error("Error initializing ConfigurableAgeOffFilter: invalid <ttl> value:" + options.get(AgeOffConfigParams.TTL)); return false; } if (options.containsKey(AgeOffConfigParams.TTL_SHORT_CIRCUIT)) { try { Integer.parseInt(options.get(AgeOffConfigParams.TTL_SHORT_CIRCUIT)); } catch (NumberFormatException nfe) { log.error("Error initializing ConfigurableAgeOffFilter: invalid <ttlShortCircuit> value:" + options.get(AgeOffConfigParams.TTL_SHORT_CIRCUIT)); return false; } } String ttlUnits = options.get(AgeOffConfigParams.TTL_UNITS); List<String> allUnits = Arrays.asList( AgeOffTtlUnits.DAYS, AgeOffTtlUnits.HOURS, AgeOffTtlUnits.MINUTES, AgeOffTtlUnits.SECONDS, AgeOffTtlUnits.MILLISECONDS); return (ttlUnits != null) && allUnits.contains(ttlUnits); } ConfigurableAgeOffFilter();  ConfigurableAgeOffFilter(ConfigurableAgeOffFilter other, IteratorEnvironment env); @Override boolean accept(Key k, Value v); @Override SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env); @Override void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env); @Override IteratorOptions describeOptions(); @Override boolean validateOptions(Map<String,String> options); static void clearCache(); static LoadingCache<FileRuleWatcher,Collection<FilterRule>> getCache(); @Override String toString(); static final String UPDATE_INTERVAL_MS_PROP; static final String EXPIRATION_INTERVAL_MS_PROP; }### Answer:
@Test public void testValidateOptions() { ConfigurableAgeOffFilter filter = new ConfigurableAgeOffFilter(); Map<String,String> options = new HashMap<>(); options.put(AgeOffConfigParams.TTL, "1"); List<String> allUnits = Arrays.asList( AgeOffTtlUnits.DAYS, AgeOffTtlUnits.HOURS, AgeOffTtlUnits.MINUTES, AgeOffTtlUnits.SECONDS, AgeOffTtlUnits.MILLISECONDS); for (String unit : allUnits) { options.put(AgeOffConfigParams.TTL_UNITS, unit); assertThat(filter.validateOptions(options), is(true)); } options.put(AgeOffConfigParams.TTL_UNITS, "parsecs"); assertThat(filter.validateOptions(options), is(false)); options.put(AgeOffConfigParams.TTL, "0x143"); options.put(AgeOffConfigParams.TTL_UNITS, AgeOffTtlUnits.DAYS); assertThat(filter.validateOptions(options), is(false)); }