public void testMultipleExamples() throws Exception {
    String[] examples = {"e1", "e2"};
    String docDefSource =
        "<aura:documentation>"
            + "<aura:description>random description</aura:description>"
            + "<aura:example name='"
            + examples[0]
            + "' ref='foo:bar1' label='"
            + examples[0]
            + "'>"
            + examples[0]
            + "</aura:example>"
            + "<aura:example name='"
            + examples[1]
            + "' ref='foo:bar2' label='"
            + examples[1]
            + "'>"
            + examples[1]
            + "</aura:example>"
            + "</aura:documentation>";

    DocumentationDef dd = parse(docDefSource);
    dd.validateDefinition();

    Map<String, ExampleDef> exDefs = dd.getExampleDefsAsMap();
    assertEquals(2, exDefs.size());

    for (String d : examples) {
      ExampleDef ex = exDefs.get(d);
      assertNotNull(ex);
      assertEquals(d, ex.getLabel());
      assertEquals(d, ex.getDescription());
    }
  }
  public void testDocDefWithExample() throws Exception {
    String description = "myDescription";
    String exampleName = "myExample";
    String exampleLabel = "my Label";
    String exampleRef = "hello:world";
    String exampleDesc = "example description";
    String example =
        "<aura:example name='"
            + exampleName
            + "' ref='"
            + exampleRef
            + "' label='"
            + exampleLabel
            + "'>"
            + exampleDesc
            + "</aura:example>";
    String docDefSource =
        "<aura:documentation><aura:description>"
            + description
            + "</aura:description>"
            + example
            + "</aura:documentation>";

    DocumentationDef dd = parse(docDefSource);
    dd.validateDefinition();

    List<ExampleDef> descDefs = dd.getExampleDefs();
    assertEquals(1, descDefs.size());
    ExampleDef ed = descDefs.get(0);
    assertEquals(exampleLabel, ed.getLabel());
    assertEquals(exampleName, ed.getName());
    assertEquals(exampleRef, ed.getRef().getNamespace() + ":" + ed.getRef().getName());
    assertEquals(exampleDesc, ed.getDescription());
  }