assertEquals("ResourceDef type must match library type", e.getMessage());
}
}
public void testComparingLibraryDefs() throws Exception{
ClientLibraryDef cdf1 = getElement("<aura:clientLibrary name='HTML5Shiv' type='JS'/>");
assertFalse(cdf1.equals(null));
assertFalse(cdf1.equals(""));
ClientLibraryDef sameLibraryTag = getElement("<aura:clientLibrary name='HTML5Shiv' type='JS'/>");
assertTrue("Same library tag should be considered duplicates",
cdf1.equals(sameLibraryTag));
//When two components include same library for different modes, the final clientLibrary set should include for both modes
ClientLibraryDef sameLibraryButDifferentModes1 = getElement("<aura:clientLibrary name='HTML5Shiv' type='JS' modes='DEV'/>");
ClientLibraryDef sameLibraryButDifferentModes2 = getElement("<aura:clientLibrary name='HTML5Shiv' type='JS' modes='JSTEST'/>");
assertFalse("Same library tag marked for different modes should not be considered duplicates",
sameLibraryButDifferentModes1.equals(sameLibraryButDifferentModes2));
ClientLibraryDef sameNameButDifferentType1 = getElement("<aura:clientLibrary name='UIPerf' type='CSS'/>");
ClientLibraryDef sameNameButDifferentType2 = getElement("<aura:clientLibrary name='UIPerf' type='JS'/>");
assertFalse("Same library with diffrent types should not be considered duplicates",
sameNameButDifferentType1.equals(sameNameButDifferentType2));
ClientLibraryDef sameNameButDifferentUrl1 = getElement("<aura:clientLibrary name='UIPerf' url='/auraFW/resources/UIPerf/UIPerf.js' type='CSS'/>");
ClientLibraryDef sameNameButDifferentUrl2 = getElement("<aura:clientLibrary name='UIPerf' url='/auraFW/resources/UIPerf/UIPerf1.js' type='JS'/>");
assertFalse("Same library with diffrent types should not be considered duplicates",
sameNameButDifferentUrl1.equals(sameNameButDifferentUrl2));
ClientLibraryDef sameUrlButDifferentName1 = getElement("<aura:clientLibrary name='UIPerf' url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
ClientLibraryDef sameUrlButDifferentName2 = getElement("<aura:clientLibrary name='Kylie' url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
assertTrue("Same library url with different names should not be considered duplicates",
sameUrlButDifferentName1.equals(sameUrlButDifferentName2));
ClientLibraryDef sameUrl1 = getElement("<aura:clientLibrary url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
ClientLibraryDef sameUrl2 = getElement("<aura:clientLibrary url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
assertTrue("Library tags without a name but same URL should be considered equal", sameUrl1.equals(sameUrl2));
ClientLibraryDef sameUrlDifferentName1 = getElement("<aura:clientLibrary name='name' url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
ClientLibraryDef sameUrlDifferentName2 = getElement("<aura:clientLibrary name='name2' url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
assertTrue("Library tags without a name but same URL should be considered equal", sameUrlDifferentName1.equals(sameUrlDifferentName2));
ClientLibraryDef sameUrl3 = getElement("<aura:clientLibrary url='/auraFW/resources/UIPerf/UIPerf.js' type='JS'/>");
ClientLibraryDef sameUrl4 = getElement("<aura:clientLibrary url='/auraFW/resources/UIPerf/UIPerf1.js' type='JS'/>");
assertFalse("Library tags without a name and different URLs should not equal", sameUrl3.equals(sameUrl4));
ClientLibraryDef sameButAllMode = getElement("<aura:clientLibrary name='UIPerf' type='JS' />");
ClientLibraryDef sameButDifferentMode = getElement("<aura:clientLibrary name='UIPerf' type='JS' modes='PTEST' />");
assertTrue("Library which includes all modes is equal to one which specifies one",
sameButAllMode.equals(sameButDifferentMode));
ClientLibraryDef sameButCombine = getElement("<aura:clientLibrary name='UIPerf' type='JS' combine='true' />");
ClientLibraryDef sameButNotCombine = getElement("<aura:clientLibrary name='UIPerf' type='JS' modes='PTEST' />");
assertTrue("Library with different combine attribute is still the same",
sameButCombine.equals(sameButNotCombine));
}