public void testDesignTemplateWithRegions() throws Exception {
ComponentDef cmp = Aura.getDefinitionService().getDefinition("test:fakeDesign", ComponentDef.class);
DesignDef c = cmp.getDesignDefDescriptor().getDef();
assertNotNull("DesignDef not found!", c);
DesignTemplateDef template = c.getDesignTemplateDef();
assertNotNull("DesignTemplateDef not found!", template);
DesignTemplateRegionDef regionOne = template.getDesignTemplateRegionDef("regionOne");
assertNotNull("DesignTemplateRegionDef regionOne not found!", regionOne);
assertTrue("DesignTemplateRegionDef regionOne should have one allowed interface.", regionOne
.getAllowedInterfaces().size() == 1);
for (DefDescriptor<InterfaceDef> intf : regionOne.getAllowedInterfaces()) {
assertTrue("InterfaceDef not found!", intf.exists());
}
DesignTemplateRegionDef regionTwo = template.getDesignTemplateRegionDef("regionTwo");
assertNotNull("DesignTemplateRegionDef regionTwo not found!", regionTwo);
assertTrue("DesignTemplateREgionDef regionTwo should not have any allowed interfaces.", regionTwo
.getAllowedInterfaces().isEmpty());
DesignTemplateRegionDef regionThree = template.getDesignTemplateRegionDef("regionThree");
assertNotNull("DesignTemplateRegionDef regionThree not found!", regionThree);
assertTrue("DesignTemplateRegionDef regionThree should have two allowed interfaces.", regionThree
.getAllowedInterfaces().size() == 2);
for (DefDescriptor<InterfaceDef> intf : regionThree.getAllowedInterfaces()) {
assertTrue("InterfaceDef not found!", intf.exists());