@Test
public void testAdd() throws Exception {

    final ActiveGrammarSet set = new ActiveGrammarSet(observer);
    set.add(document1);
    set.add(document2);
    set.add(document1);
    final SrgsXmlDocument doc3 = new SrgsXmlDocument();
    final Grammar grammar3 = doc3.getGrammar();
    grammar3.setVersion("1.0");
    final Rule rule3 = grammar3.appendChild(Rule.class);
    rule3.setId("test");
    rule3.addText("test input");
    grammar3.setRoot(rule3);
    final InternalGrammarDocument document3 =
            new InternalGrammarDocument(grammar3);
    set.add(document3);
    final byte[] buffer = grammar3.toString().getBytes();
    final String encoding = System.getProperty("jvoicexml.xml.encoding",
            "UTF-8");
    final ExternalGrammarDocument document4 =
            new ExternalGrammarDocument(null, buffer, encoding, true);
    set.add(document4);
    final Collection<GrammarDocument> docs = set.getGrammars();
    Assert.assertEquals(2, docs.size());
}