use of org.whole.lang.java.model.IfStatement in project whole by wholeplatform.
the class SelectQueriesTest method testSelectTemplateFromPattern.
@Test
public void testSelectTemplateFromPattern() {
ITemplateManager tm = SelectQueriesTemplateManager.instance();
JavaEntityFactory ef = JavaEntityFactory.instance;
IfStatement ifStm = ef.createIfStatement(ef.createPrefixExpression(ef.createPrefixOperator(PrefixOperatorEnum.not), ef.createInfixExpression(ef.createSimpleName("x"), ef.createInfixOperator(InfixOperatorEnum.less), ef.createIntLiteral(3), ef.createExpressions(0))), ef.createEmptyStatement(), ef.createBlock(ef.createExpressionStatement(ef.createAssignment()), ef.createExpressionStatement(ef.createAssignment())));
PathExpression pe1 = (PathExpression) tm.create("selectTemplateFromPattern");
IfStatement t = BehaviorUtils.<IfStatement>evaluateFirstResult(pe1, ifStm);
assertEquals(JavaEntityDescriptorEnum.PrefixExpression, t.getExpression().wGetEntityDescriptor());
assertTrue(Matcher.match(ifStm.getElseStatement(), t.getThenStatement()));
assertTrue(Matcher.match(ifStm.getThenStatement(), t.getElseStatement()));
}
Aggregations