EClass eClass = createMock(EClass.class);
EStructuralFeature feature = createMock(EStructuralFeature.class);
Antlr4Validator validator = PowerMock.createPartialMock(Antlr4Validator.class, "error");
expect(grammar.getType()).andReturn(GrammarType.TREE);
expect(grammar.eClass()).andReturn(eClass);
expect(eClass.getEStructuralFeature("name")).andReturn(feature);
PowerMock.expectPrivate(validator, "error", "tree grammars are not supported in ANTLR 4",
grammar, feature);