BinaryKeywordNode implements Node { @Override public Node selectChild(Request request) { String requestText = request.getText().toLowerCase(); String[] tokens = tokenizer.tokenize(requestText); if (tokens.length == 0) { return null; } for (String keyword : keywords) { if (Arrays.asList(tokens).contains(keyword)) { return matchedNode; } } return nonMatchedNode; } BinaryKeywordNode(String keyword, Node matchNode, Node nonMatchNode);  BinaryKeywordNode(String[] keywords, Node matchNode, Node nonMatchNode); @Override Node selectChild(Request request); @Override Node[] getChildren(); @Override boolean isLeaf(); @Override Agent[] getValue();  }
@Test public void testNoText() { Agent a1 = mock(Agent.class); Agent a2 = mock(Agent.class); Node node = new BinaryKeywordNode("weather", new LeafNode(a1), new LeafNode(a2)); assertNull(node.selectChild(new Request(""))); }