EList<PrequelConstruct> prequels = new BasicEList<PrequelConstruct>();
EList<LexerRule> modeRules = new BasicEList<LexerRule>();
EList<Mode> modes = new BasicEList<Mode>();
Grammar grammar = createMock(Grammar.class);
LexerRule rule = createMock(LexerRule.class);
LexerRule ref = createMock(LexerRule.class);
IScope scope = createMock(IScope.class);
Mode mode = createMock(Mode.class);
LexerRule modeRule = createMock(LexerRule.class);
Antlr4ScopeProvider scopeProvider = PowerMock.createPartialMock(Antlr4ScopeProvider.class,
"scopeFor", PrequelConstruct.class, List.class, Class.class);
Class[] prequelTypes = {Imports.class, Options.class, V3Tokens.class, V4Tokens.class,
EmptyTokens.class, GrammarAction.class };
for (Class prequelType : prequelTypes) {
PrequelConstruct prequel = createMock(prequelType);
prequels.add(prequel);
scopeProvider.scopeFor(eq(prequel), isA(List.class), eq(LexerRule.class));
}
rules.add(ref);
modeRules.add(modeRule);
modes.add(mode);
scopes.add(ref);
scopes.add(mode);
scopes.add(modeRule);
expect(rule.eContainer()).andReturn(grammar);
expect(grammar.eContainer()).andReturn(null);
expect(grammar.getRules()).andReturn(rules);
expect(grammar.getPrequels()).andReturn(prequels);
expect(grammar.getModes()).andReturn(modes);
expect(mode.getRules()).andReturn(modeRules);
PowerMock.mockStatic(Scopes.class);