@Test
    public void testReader() throws Exception
    {
        // Setup test fixture.
        final Reader input = new StringReader("<foo><bar>test</bar></foo>");

        // Execute system under test.
        final Document output = SAXReaderUtil.readDocument(input);

        // Verify result.
        assertNotNull(output);
        assertEquals("foo", output.getRootElement().getName());
        assertNotNull(output.getRootElement().element("bar"));
        assertEquals("test", output.getRootElement().elementText("bar"));
    }
Asserts that XML text can be parsed when provided as a Reader.
xmppserver/src/test/java/org/jivesoftware/util/SAXReaderUtilTest.java