public void checkRuleRedefinitionInModes() throws Exception {
EList<Mode> modes = new BasicEList<Mode>();
EList<LexerRule> rules = new BasicEList<LexerRule>();
Grammar grammar = createMock(Grammar.class);
LexerRule rule1 = createMock(LexerRule.class);
LexerRule rule2 = createMock(LexerRule.class);
EClass eClass = createMock(EClass.class);
EStructuralFeature feature = createMock(EStructuralFeature.class);
Mode mode = createMock(Mode.class);
Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");
expect(grammar.getRules()).andReturn(new BasicEList<Rule>());
expect(grammar.getModes()).andReturn(modes);
expect(mode.getRules()).andReturn(rules);
expect(rule1.getName()).andReturn("Rule");
expect(rule2.getName()).andReturn("Rule");
expect(rule2.eClass()).andReturn(eClass);
expect(eClass.getEStructuralFeature("name")).andReturn(feature);
PowerMock.expectPrivate(validator, "error", "rule 'Rule' redefinition", rule2, feature);