assertExceptionMessageEndsWith(e, InvalidDefinitionException.class, "name is a required attribute on tag registerevent");
}
}
public void testMissingNameForApplicationEvent() throws Exception {
XMLParser parser = XMLParser.getInstance();
DefDescriptor<EventDef> eventDesc = addSourceAutoCleanup(EventDef.class, "<aura:event type='APPLICATION'/>");
DefDescriptor<ComponentDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", ComponentDef.class);
StringSource<ComponentDef> source = new StringSource<>(
descriptor,
String.format("<aura:component><aura:registerevent type='%s'/></aura:component>",eventDesc.getDescriptorName()),
"myID", Format.XML);
ComponentDef def = parser.parse(descriptor, source);
try {
def.validateDefinition();
fail("Missing name for application event should be flagged");
} catch (Exception e) {
assertExceptionMessageEndsWith(e, InvalidDefinitionException.class, "name is a required attribute on tag registerevent");