/**
* Verify that the css writer writes in the order given.
*/
public void testCSSOrder() throws Exception {
ServerService ss = Aura.getServerService();
DefDescriptor<ApplicationDef> appDesc = Aura.getDefinitionService()
.getDefDescriptor("auratest:test_SimpleServerRenderedPage", ApplicationDef.class);
DefDescriptor<ComponentDef> grandparent = Aura.getDefinitionService()
.getDefDescriptor("setAttributesTest:grandparent", ComponentDef.class);
DefDescriptor<ComponentDef> parent = Aura.getDefinitionService()
.getDefDescriptor("setAttributesTest:parent", ComponentDef.class);
DefDescriptor<ComponentDef> child1 = Aura.getDefinitionService()
.getDefDescriptor("setAttributesTest:child", ComponentDef.class);
DefDescriptor<ComponentDef> child2 = Aura.getDefinitionService()
.getDefDescriptor("setAttributesTest:anotherChild", ComponentDef.class);
Aura.getContextService().startContext(AuraContext.Mode.DEV, AuraContext.Format.CSS,
AuraContext.Authentication.AUTHENTICATED, appDesc);
Set<DefDescriptor<?>> writable = Sets.newLinkedHashSet();
writable.add(child1.getDef().getStyleDescriptor());
writable.add(grandparent.getDef().getStyleDescriptor());
writable.add(parent.getDef().getStyleDescriptor());
writable.add(child2.getDef().getStyleDescriptor());
StringWriter output = new StringWriter();
ss.writeAppCss(writable, output);
String css = output.toString();
//
// order should be exactly that above.
// child1, grandparent, parent, child2