@Test
public void testSerialize() throws Exception {

    System.setProperty("jvoicexml.xml.encoding", "UTF-8");
    final SsmlDocument doc = new SsmlDocument();
    final Speak speak = doc.getSpeak();
    speak.addText("Hello World!");
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final ObjectOutputStream oout = new ObjectOutputStream(out);
    oout.writeObject(doc);
    final ByteArrayInputStream in =
        new ByteArrayInputStream(out.toByteArray());
    final ObjectInputStream oin = new ObjectInputStream(in);
    final Object o = oin.readObject();
    Assert.assertEquals(doc.toString(), o.toString());
    final String str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
        + "<speak><audio "
        + "src=\"http://localhost:8080/ivr.audios-0.0.1/a774.wav\"></audio>"
        + "</speak>";
    final StringReader reader = new StringReader(str);
    final InputSource source = new InputSource(reader);
    final SsmlDocument doc2 = new SsmlDocument(source);
    final ByteArrayOutputStream out2 = new ByteArrayOutputStream();
    final ObjectOutputStream oout2 = new ObjectOutputStream(out2);
    oout2.writeObject(doc2);
    final ByteArrayInputStream in2 =
        new ByteArrayInputStream(out2.toByteArray());
    final ObjectInputStream oin2 = new ObjectInputStream(in2);
    final Object o2 = oin2.readObject();
    Assert.assertEquals(doc2.toString(), o2.toString());
}