@Test
    public void testFunctionCycleSerialization() throws ParseException {
        List<ExpressionFunction> functions = new ArrayList<>();
        functions.add(new ExpressionFunction("foo", null, new RankingExpression("bar")));
        functions.add(new ExpressionFunction("bar", null, new RankingExpression("foo")));

        RankingExpression exp = new RankingExpression("first-phase", "foo");
        try {
            exp.getRankProperties(new SerializationContext(functions, Optional.empty()));
            fail("Expected exception");
        } catch (RuntimeException e) {
            assertEquals("Cycle in ranking expression function 'foo' called from: [foo[], bar[]]", e.getMessage());
        }
    }
@author Simon Thoresen Hult
@author bratseth
searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/RankingExpressionTestCase.java