GenericKeywordNode implements Node { @Override public Node selectChild(Request request) { String requestText = request.getText().toLowerCase(); String[] tokens = tokenizer.tokenize(requestText); for (String token : tokens) { if (children.containsKey(token)) { return children.get(token); } } return null; } GenericKeywordNode(); void addChild(String keyword, Node node); void addChild(String[] keywords, Node node); @Override Node selectChild(Request request); @Override Node[] getChildren(); @Override boolean isLeaf(); @Override Agent[] getValue();  }
@Test public void testNoMatch() { Request request = new Request("Where is the door?"); assertNull(node.selectChild(request)); }
@Test public void testNoText() { Request request = new Request(""); assertNull(node.selectChild(request)); }