Grammar grammar = createMock(Grammar.class);
ParserRule rule1 = createMock(ParserRule.class);
Return returns = createMock(Return.class);
LocalVars locals = createMock(LocalVars.class);
RuleBlock ruleBody = createMock(RuleBlock.class);
RuleRef ruleRef = createMock(RuleRef.class);
ParserRule expr = createMock(ParserRule.class);
ActionElement actionElement = createMock(ActionElement.class);
Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");
expect(grammar.getRules()).andReturn(rules);
expect(rule1.getArgs()).andReturn(null);
expect(rule1.getReturn()).andReturn(returns);
expect(rule1.getLocals()).andReturn(locals);
expect(rule1.getBody()).andReturn(ruleBody).times(2);
expect(returns.getBody()).andReturn(null);
expect(locals.getBody()).andReturn(null);
ruleBodyList.add(ruleRef);
ruleBodyList.add(actionElement);
expect(ruleBody.eAllContents()).andReturn(newTreeIterator(ruleBodyList));
expect(ruleBody.eAllContents()).andReturn(newTreeIterator(ruleBodyList));
expect(ruleRef.getReference()).andReturn(expr);
expect(expr.getName()).andReturn("expr");
expect(actionElement.getBody()).andReturn("{int v = $expr.v;}");