use of org.olat.course.condition.interpreter.ConditionInterpreter in project openolat by klemens.
the class ConditionTest method simpleExpresion.
@Test
public void simpleExpresion() throws Exception {
UserCourseEnvironment uce = getUserDemoCourseEnvironment();
ConditionInterpreter interpreter = new ConditionInterpreter(uce);
String condition = "now >= date(\"03.07.2012 08:26\")";
boolean result = interpreter.evaluateCondition(condition);
Assert.assertTrue(result);
Collection<Object> tokens = interpreter.getParsedTokens(condition);
Assert.assertNotNull(tokens);
Assert.assertFalse(tokens.isEmpty());
}
use of org.olat.course.condition.interpreter.ConditionInterpreter in project openolat by klemens.
the class ConditionTest method syntaxProposal.
@Test
public void syntaxProposal() throws Exception {
UserCourseEnvironment uce = getUserDemoCourseEnvironment();
ConditionInterpreter interpreter = new ConditionInterpreter(uce);
String condition = "inLearningGroup(\"16872486<Rule1Group1>\")";
boolean result = interpreter.evaluateCondition(condition);
Assert.assertFalse(result);
Collection<Object> tokens = interpreter.getParsedTokens(condition);
Assert.assertNotNull(tokens);
Assert.assertFalse(tokens.isEmpty());
for (Object token : tokens) {
System.out.println(token.getClass().getName());
}
}
Aggregations