### Question:
Grammar { public List<Rule> getLexicalRules(List<String> rhs){ StringTuple tuple = StringTuple.fromList(rhs); return lexicalRules.containsKey(tuple) ? lexicalRules.get(tuple) : Collections.emptyList(); } Grammar(List<Rule> rules, String rootCategory); boolean isRoot(Rule rule); List<Rule> getLexicalRules(List<String> rhs); List<Rule> getUnaryRules(String rhs); List<Rule> getBinaryRules(String left, String right); Set<Rule> getNonTerminalRules();  }### Answer:
@Test void getLexicalRules() { List<Rule> rules = Collections.singletonList(new Rule("$A", "B C")); Grammar grammar = new Grammar(rules, "$ROOT"); assertEquals(rules.get(0), grammar.getLexicalRules(Arrays.asList("B", "C")).get(0)); assertEquals(0, grammar.getBinaryRules("$B", "$C").size()); assertEquals(0, grammar.getUnaryRules("$B").size()); }