### Question:
ConfigIpFilter implements IpFilter { @Override public boolean accept(String ip) { if (allowFirst) return accepAllowFirst(ip); else return acceptDenyFirst(ip); } ConfigIpFilter(Config config); @Override boolean accept(String ip);  }### Answer:
@Test public void shouldReturnTrueDupIpInAllowAndDenyListWhenAllowFirst() { Config config = new Config(); config.setAllowFirst(true); config.allow("1.2.3.4"); config.deny("1.2.3.4"); IpFilter ipFilter = new ConfigIpFilter(config); assertTrue(ipFilter.accept("1.2.3.4")); }
@Test public void shouldReturnFalseDupIpInAllowAndDenyListWhenDenyFirst() { Config config = new Config(); config.setAllowFirst(false); config.allow("1.2.3.4"); config.deny("1.2.3.4"); IpFilter ipFilter = new ConfigIpFilter(config); assertFalse(ipFilter.accept("1.2.3.4")); }