NodeFilter { public boolean accept(Node node) { for (Entry entry : entries) { if (entry.accept(node)) return true; } return false; }  void add(byte[] nodeId, String hostIpPattern); boolean accept(Node node); boolean accept(InetAddress nodeAddr);  }
@Test public void addInvalidNodeShouldThrowException() throws Exception { NodeFilter filter = new NodeFilter(); assertFalse(filter.accept(createTestNode("invalid-1", null))); }
@Test public void neverAcceptOnEmptyFilter() throws Exception { NodeFilter filter = new NodeFilter(); assertFalse(filter.accept(createTestNode("node-1", "1.2.3.4"))); assertFalse(filter.accept(createTestNode("node-2", "1.2.3.4"))); assertFalse(filter.accept(createTestNode("node-2", "1.2.3.99"))); assertFalse(filter.accept(createTestNode("node-2", "1.2.99.99"))); assertFalse(filter.accept(createTestNode("node-2", "1.99.99.99"))); assertFalse(filter.accept(createTestNode("node-2", "2.99.99.99"))); }