/**
* Tests the ordering logic of the {@link LibraryDef} to ensure that imports will be serialized in order.
*/
public void testIncludeOrderingOneDependsOnRest() throws Exception {
LibraryDef libDef = Aura.getDefinitionService().getDefinition(
"test:test_LibraryIncludeOrderingOneDependsOnRest", LibraryDef.class);
assertNotNull(libDef);
String libraryName1 = libDef.getIncludes().get(0).getName();
String libraryName2 = libDef.getIncludes().get(1).getName();
String libraryName3 = libDef.getIncludes().get(2).getName();
assertEquals(4, libDef.getIncludes().size());
// Ensure no dependency-included-twice malarkey:
assertFalse(libraryName1.equals(libraryName2));
assertFalse(libraryName2.equals(libraryName3));
assertFalse(libraryName1.equals(libraryName3));
// a, b, c are not required to be in any particular order since they have no dependencies:
assertTrue(libraryName1.equals("a") || libraryName1.equals("b") || libraryName1.equals("c"));
assertTrue(libraryName2.equals("a") || libraryName2.equals("b") || libraryName2.equals("c"));
assertTrue(libraryName3.equals("a") || libraryName3.equals("b") || libraryName3.equals("c"));
// d needs to be the last included dependency:
assertEquals("d", libDef.getIncludes().get(3).getName());
}