List<Pair<? extends Comparable<?>, INode>> caseTerms = new ArrayList<>();
caseTerms.add(new Pair<Comparable<?>, INode>(2, new ValueNode<>(3)));
caseTerms.add(new Pair<Comparable<?>, INode>(1, new AddNode(
new ValueNode<>(3), new ValueNode<>(3))));
CaseNode cn = new CaseNode(new ValueNode<>(2), caseTerms);
ValueNode<Integer> res = cn.calc(null);
assertTrue(res.getValue().compareTo(3) == 0);
cn = new CaseNode(new ValueNode<>(1), caseTerms);
res = cn.calc(null);
assertTrue(res.getValue().compareTo(6) == 0);
cn = new CaseNode(new ValueNode<>(4), caseTerms);
res = cn.calc(null);
assertTrue(res == null);
caseTerms.add(new Pair<Comparable<?>, INode>(null, new ValueNode<>(31)));
cn = new CaseNode(new ValueNode<>(4), caseTerms);
res = cn.calc(null);
assertTrue(res.getValue().compareTo(31) == 0);
}