XMLParser parser = XMLParser.getInstance();
DefDescriptor<ComponentDef> descriptor = DefDescriptorImpl.getInstance("test:fakeparser", ComponentDef.class);
StringSource<ComponentDef> source = new StringSource<>(descriptor, "<aura:component>"
+ "<aura:registerevent name='dupName' type='aura:click'/>"
+ "<aura:registerevent name='dupName' type='aura:click'/>" + "</aura:component>", "myID", Format.XML);
ComponentDef cd = parser.parse(descriptor, source);
try {
cd.validateDefinition();
fail("Should have thrown AuraRuntimeException for registering two events with the same name");
} catch (Exception e) {
checkExceptionContains(e, InvalidDefinitionException.class,
"Multiple events registered with name");
}