@Test
    public void testInfiniteRecursion() throws Exception {
        // father_of(GP, C) :- father_of(GP, P), father_of(P, C).
        KnowledgeBase knowledgeBase = new KnowledgeBase();
        knowledgeBase.registerRule(new Rule(new Predicate("father_of", new Variable("GP"), new Variable("C")),
                new Predicate("father_of", new Variable("GP"), new Variable("P")), new Predicate("father_of", new Variable("P"), new Variable("C"))));

        try {
            Evaluator evaluator = new Evaluator(new RobinsonUnificationStrategy(), knowledgeBase);
            evaluator.prove(new EvaluationHandler() {
                public boolean foundResult(Map<Variable, Term> result) {
                    fail("This evaluation shouldn't find a result, but it has found '" + result + "'");
                    return false;
                }
            }, new Predicate("father_of", new Constant("john"), new Constant("richard")));

            fail("This evaluation should have provoked an exception as it's an infinite recursion.");
        } catch (InfiniteRecursionException ex) {
            // Expected exception
        }
    }