### Question:
RecursiveEvaluation implements NullaryFunction<Object> { public final Object evaluate() { Object result = null; while (true) { result = function.evaluate(); if (functionType.isInstance(result)) { function = (NullaryFunction<?>) result; continue; } else { break; } } return result; } RecursiveEvaluation(NullaryFunction<?> function);  RecursiveEvaluation(NullaryFunction<?> function, Class<?> functionType); final Object evaluate(); @Override final boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testRecurse() { assertEquals(Integer.valueOf(5), new RecursiveEvaluation(new RecFunc(0, false)).evaluate()); @SuppressWarnings({ "unchecked", "rawtypes" }) NullaryFunction<Object> func = (NullaryFunction) new RecursiveEvaluation(new RecFunc(0, true)).evaluate(); assertEquals(Integer.valueOf(5), func.evaluate()); }