EStructuralFeature feature = createMock(EStructuralFeature.class);
Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");
expect(grammar.getType()).andReturn(GrammarType.PARSER);
expect(rule.eContainer()).andReturn(grammar);
expect(rule.eClass()).andReturn(eClass);
expect(rule.getName()).andReturn("RULE");
expect(eClass.getEStructuralFeature("name")).andReturn(feature);
PowerMock.expectPrivate(validator, "error", "lexer rule 'RULE' not allowed in parser",