maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ltheu...@apache.org
Subject svn commit: r732140 [1/2] - /maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/
Date Tue, 06 Jan 2009 22:01:30 GMT
Author: ltheussl
Date: Tue Jan  6 14:01:29 2009
New Revision: 732140

URL: http://svn.apache.org/viewvc?rev=732140&view=rev
Log:
Split DefaultSiteRendererTest into separate verifiers, one for each test.

Added:
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/MiscVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/MultipleBlockVerifier.java   (with props)
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/NestedItemsVerifier.java   (with props)
Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java?rev=732140&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java Tue Jan  6 14:01:29 2009
@@ -0,0 +1,69 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+import java.io.File;
+
+import org.codehaus.plexus.PlexusTestCase;
+
+/**
+ * Abstract base class for verifiers.
+ *
+ * @author ltheussl
+ * @version $Id$
+ */
+public abstract class AbstractVerifier
+    extends PlexusTestCase
+{
+    /**
+     * Get a HtmlPage from a file.
+     *
+     * @param htmlFile the file to parse.
+     *
+     * @return a HtmlPage.
+     *
+     * @throws Exception if something goes wrong.
+     */
+    protected HtmlPage htmlPage( String htmlFile )
+            throws Exception
+    {
+        File file = getTestFile( htmlFile );
+        assertNotNull( file );
+        assertTrue( file.exists() );
+
+        // HtmlUnit
+        WebClient webClient = new WebClient();
+
+        return (HtmlPage) webClient.getPage( file.toURI().toURL() );
+    }
+
+    /**
+     * Verify a HtmlPage.
+     *
+     * @param file the file to verify.
+     *
+     * @throws java.lang.Exception if something goes wrong;
+     */
+    public abstract void verify( String file )
+            throws Exception;
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java?rev=732140&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java Tue Jan  6 14:01:29 2009
@@ -0,0 +1,102 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader2;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+
+import java.util.Iterator;
+
+
+/**
+ * 
+ *
+ * @author ltheussl
+ * @version $Id$
+ */
+public class AptVerifier
+    extends AbstractVerifier
+{
+    /** {@inheritDoc} */
+    public void verify( String file )
+            throws Exception
+    {
+        HtmlPage page = htmlPage( file );
+        assertNotNull( page );
+
+        HtmlElement element = page.getHtmlElementById( "contentBox" );
+        assertNotNull( element );
+        HtmlDivision division = (HtmlDivision) element;
+        assertNotNull( division );
+
+        Iterator elementIterator = division.getAllHtmlChildElements();
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        HtmlDivision div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+
+        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
+        assertNotNull( h2 );
+        assertEquals( "Links", h2.asText().trim() );
+
+        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Links", a.getAttributeValue( "name" ) );
+
+        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Anchor", a.getAttributeValue( "name" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "cdc.html", a.getAttributeValue( "name" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Anchor_with_space", a.getAttributeValue( "name" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor_with_space", a.getAttributeValue( "href" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
+        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
+        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "./cdc.html", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#cdc.html", a.getAttributeValue( "href" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "/index.html", a.getAttributeValue( "href" ) );
+    }
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AptVerifier.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java?rev=732140&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java Tue Jan  6 14:01:29 2009
@@ -0,0 +1,209 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader2;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader3;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell;
+import com.gargoylesoftware.htmlunit.html.HtmlTableHeaderCell;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+import com.gargoylesoftware.htmlunit.html.UnknownHtmlElement;
+
+import java.util.Iterator;
+
+
+/**
+ * 
+ *
+ * @author ltheussl
+ * @version $Id$
+ */
+public class AttributesVerifier
+    extends AbstractVerifier
+{
+    /** {@inheritDoc} */
+    public void verify( String file )
+            throws Exception
+    {
+        HtmlPage page = htmlPage( file );
+        assertNotNull( page );
+
+        HtmlElement element = page.getHtmlElementById( "contentBox" );
+        assertNotNull( element );
+        HtmlDivision division = (HtmlDivision) element;
+        assertNotNull( division );
+
+        Iterator elementIterator = division.getAllHtmlChildElements();
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        HtmlDivision div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+
+        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
+        assertNotNull( h2 );
+        assertEquals( "section", h2.asText().trim() );
+
+        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
+        assertNotNull( a );
+        assertEquals( "section", a.getAttributeValue( "name" ) );
+
+        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        assertEquals( "ID",  p.getAttributeValue( "id" ) );
+        assertEquals( "CLASS", p.getAttributeValue( "class" ) );
+        assertEquals( "TITLE", p.getAttributeValue( "title" ) );
+        assertEquals( "STYLE", p.getAttributeValue( "style" ) );
+        assertEquals( "LANG", p.getAttributeValue( "lang" ) );
+
+        HtmlImage img = (HtmlImage) elementIterator.next();
+        assertNotNull( img );
+
+        assertEquals( "project.png", img.getAttributeValue( "src" ) );
+        assertEquals( "150", img.getAttributeValue( "width" ) );
+        assertEquals( "93", img.getAttributeValue( "height" ) );
+        assertEquals( "border: 1px solid silver", img.getAttributeValue( "style" ) );
+        assertEquals( "Project", img.getAttributeValue( "alt" ) );
+
+        // test object identity to distinguish the case ATTRIBUTE_VALUE_EMPTY
+        assertTrue( img.getAttributeValue( "dummy" ) == HtmlElement.ATTRIBUTE_NOT_DEFINED );
+
+        HtmlTable table = (HtmlTable) elementIterator.next();
+        assertEquals( "1", table.getAttributeValue( "border" ) );
+        assertEquals( "none", table.getAttributeValue( "class" ) );
+
+        element = (HtmlElement) elementIterator.next();
+        // this is a htmlunit bug
+        assertEquals( "tbody", element.getTagName() );
+
+        HtmlTableRow tr = (HtmlTableRow) elementIterator.next();
+        HtmlTableHeaderCell th = (HtmlTableHeaderCell) elementIterator.next();
+
+        th = (HtmlTableHeaderCell) elementIterator.next();
+        assertEquals( "center", th.getAttributeValue( "align" ) );
+        assertEquals( "2", th.getAttributeValue( "colspan" ) );
+        assertEquals( "50%", th.getAttributeValue( "width" ) );
+
+        tr = (HtmlTableRow) elementIterator.next();
+
+        th = (HtmlTableHeaderCell) elementIterator.next();
+        assertEquals( "left", th.getAttributeValue( "align" ) );
+        assertEquals( "2", th.getAttributeValue( "rowspan" ) );
+        assertEquals( "middle", th.getAttributeValue( "valign" ) );
+
+        HtmlTableDataCell td = (HtmlTableDataCell) elementIterator.next();
+        td = (HtmlTableDataCell) elementIterator.next();
+        tr = (HtmlTableRow) elementIterator.next();
+        td = (HtmlTableDataCell) elementIterator.next();
+        td = (HtmlTableDataCell) elementIterator.next();
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        UnknownHtmlElement unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "u", unk.getTagName() );
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "s", unk.getTagName() );
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "sub", unk.getTagName() );
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "sup", unk.getTagName() );
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "b", unk.getTagName() );
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "i", unk.getTagName() );
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "i", unk.getTagName() );
+        unk = (UnknownHtmlElement) elementIterator.next();
+        assertEquals( "b", unk.getTagName() );
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+        assertEquals( "color: red; margin-left: 20px", p.getAttributeValue( "style" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Anchor", a.getAttributeValue( "name" ) );
+
+        p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
+        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "./cdc.html", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "cdc.html", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "cdc.pdf", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "./cdc.txt", a.getAttributeValue( "href" ) );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "/index.html", a.getAttributeValue( "href" ) );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+        h2 = (HtmlHeader2) elementIterator.next();
+        assertEquals( "Section without id", h2.asText().trim() );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Section_without_id", a.getAttributeValue( "name" ) );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+        HtmlHeader3 h3 = (HtmlHeader3) elementIterator.next();
+        assertEquals( "Subsection without id", h3.asText().trim() );
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "Subsection_without_id", a.getAttributeValue( "name" ) );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "section-id", a.getAttributeValue( "name" ) );
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+        h2 = (HtmlHeader2) elementIterator.next();
+        assertEquals( "Section with id", h2.asText().trim() );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( "subsection-id", a.getAttributeValue( "name" ) );
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( "section", div.getAttributeValue( "class" ) );
+        h3 = (HtmlHeader3) elementIterator.next();
+        assertEquals( "Subsection with id", h3.asText().trim() );
+
+        assertFalse( elementIterator.hasNext() );
+    }
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AttributesVerifier.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java?rev=732140&r1=732139&r2=732140&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java (original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java Tue Jan  6 14:01:29 2009
@@ -22,46 +22,17 @@
 import java.io.File;
 import java.io.FileReader;
 import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.doxia.site.decoration.DecorationModel;
 import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader;
+
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.ReaderFactory;
 
-import com.gargoylesoftware.htmlunit.CollectingAlertHandler;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
-import com.gargoylesoftware.htmlunit.html.HtmlApplet;
-import com.gargoylesoftware.htmlunit.html.HtmlDefinitionDescription;
-import com.gargoylesoftware.htmlunit.html.HtmlDefinitionList;
-import com.gargoylesoftware.htmlunit.html.HtmlDefinitionTerm;
-import com.gargoylesoftware.htmlunit.html.HtmlDivision;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlHeader2;
-import com.gargoylesoftware.htmlunit.html.HtmlHeader3;
-import com.gargoylesoftware.htmlunit.html.HtmlHeader4;
-import com.gargoylesoftware.htmlunit.html.HtmlImage;
-import com.gargoylesoftware.htmlunit.html.HtmlListItem;
-import com.gargoylesoftware.htmlunit.html.HtmlOrderedList;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
-import com.gargoylesoftware.htmlunit.html.HtmlParameter;
-import com.gargoylesoftware.htmlunit.html.HtmlPreformattedText;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-import com.gargoylesoftware.htmlunit.html.HtmlTable;
-import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell;
-import com.gargoylesoftware.htmlunit.html.HtmlTableHeaderCell;
-import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
-import com.gargoylesoftware.htmlunit.html.HtmlUnorderedList;
-import com.gargoylesoftware.htmlunit.html.UnknownHtmlElement;
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
@@ -71,12 +42,18 @@
 public class DefaultSiteRendererTest
     extends PlexusTestCase
 {
+    /**
+     * All output produced by this test will go here.
+     */
     private static final String OUTPUT = "target/output";
 
+    /**
+     * The renderer used to produce output.
+     */
     private Renderer renderer;
 
     /**
-     * @throws java.lang.Exception
+     * @throws java.lang.Exception if something goes wrong.
      * @see org.codehaus.plexus.PlexusTestCase#setUp()
      */
     protected void setUp()
@@ -91,7 +68,7 @@
     }
 
     /**
-     * @throws java.lang.Exception
+     * @throws java.lang.Exception if something goes wrong.
      * @see org.codehaus.plexus.PlexusTestCase#tearDown()
      */
     protected void tearDown()
@@ -102,7 +79,7 @@
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void testRender()
         throws Exception
@@ -142,7 +119,7 @@
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyCdcPage()
         throws Exception
@@ -153,377 +130,27 @@
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyNestedItemsPage()
         throws Exception
     {
-        File nestedItems = getTestFile( "target/output/nestedItems.html" );
-        assertNotNull( nestedItems );
-        assertTrue( nestedItems.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( nestedItems.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        // Verify link
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( h2.asText().trim(), "List Section" );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( a.getAttributeValue( "name" ), "List_Section" );
-
-        // ----------------------------------------------------------------------
-        // Unordered lists
-        // ----------------------------------------------------------------------
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader4 h4 = (HtmlHeader4) elementIterator.next();
-        assertNotNull( h4 );
-        assertEquals( h4.asText().trim(), "Unordered lists" );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Below is an unordered list, followed by six paragraphs." );
-
-        HtmlUnorderedList ul = (HtmlUnorderedList) elementIterator.next();
-        assertNotNull( ul );
-
-        HtmlListItem li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 1." );
-
-        ul = (HtmlUnorderedList) elementIterator.next();
-        assertNotNull( ul );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.getFirstDomChild().asText().trim(), "Item 11." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.getFirstDomChild().asText().trim(), "Item 12." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 13." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 14." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 2." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 3." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 4." );
-
-        ul = (HtmlUnorderedList) elementIterator.next();
-        assertNotNull( ul );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 41." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 42." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 43." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 44." );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 1 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 2 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 3 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 4 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 5 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 6 below list." );
-
-        // ----------------------------------------------------------------------
-        // Ordered lists
-        // ----------------------------------------------------------------------
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        h4 = (HtmlHeader4) elementIterator.next();
-        assertNotNull( h4 );
-        assertEquals( h4.asText().trim(), "Ordered lists" );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Below is an ordered list, followed by six paragraphs." );
-
-        HtmlOrderedList ol = (HtmlOrderedList) elementIterator.next();
-        assertNotNull( ol );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 1." );
-
-        ol = (HtmlOrderedList) elementIterator.next();
-        assertNotNull( ol );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 11." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 12." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 13." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 14." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 2." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 3." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 4." );
-
-        ol = (HtmlOrderedList) elementIterator.next();
-        assertNotNull( ol );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 41." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 42." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 43." );
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "Item 44." );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 1 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 2 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 3 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 4 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 5 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 6 below list." );
-
-        // ----------------------------------------------------------------------
-        // Definition lists
-        // ----------------------------------------------------------------------
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        h4 = (HtmlHeader4) elementIterator.next();
-        assertNotNull( h4 );
-        assertEquals( h4.asText().trim(), "Definition lists" );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Below is a definition list, followed by six paragraphs." );
-
-        HtmlDefinitionList dl = (HtmlDefinitionList) elementIterator.next();
-        assertNotNull( dl );
-
-        HtmlDefinitionTerm dt = (HtmlDefinitionTerm) elementIterator.next();
-        assertNotNull( dt );
-        assertEquals( dt.getFirstDomChild().asText().trim(), "Term 1." );
-        HtmlDefinitionDescription dd = (HtmlDefinitionDescription) elementIterator.next();
-        assertNotNull( dd );
-        assertEquals( dd.getFirstDomChild().asText().trim(), "Description 1." );
-
-        dt = (HtmlDefinitionTerm) elementIterator.next();
-        assertNotNull( dt );
-        assertEquals( dt.getFirstDomChild().asText().trim(), "Term 2." );
-        dd = (HtmlDefinitionDescription) elementIterator.next();
-        assertNotNull( dd );
-        assertEquals( dd.getFirstDomChild().asText().trim(), "Description 2." );
-
-        dl = (HtmlDefinitionList) elementIterator.next();
-        assertNotNull( dl );
-        dt = (HtmlDefinitionTerm) elementIterator.next();
-        assertNotNull( dt );
-        assertEquals( dt.getFirstDomChild().asText().trim(), "Term 21." );
-        dd = (HtmlDefinitionDescription) elementIterator.next();
-        assertNotNull( dd );
-        assertEquals( dd.getFirstDomChild().asText().trim(), "Description 21." );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 1 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 2 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 3 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 4 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 5 below list." );
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "Paragraph 6 below list." );
-
-        assertFalse( elementIterator.hasNext() );
+        NestedItemsVerifier verifier = new NestedItemsVerifier();
+        verifier.verify( "target/output/nestedItems.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyMultipleBlock()
         throws Exception
     {
-        File multipleblock = getTestFile( "target/output/multipleblock.html" );
-        assertNotNull( multipleblock );
-        assertTrue( multipleblock.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( multipleblock.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        // Verify link
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( h2.asText().trim(), "section name" );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( a.getAttributeValue( "name" ), "section_name" );
-
-        // ----------------------------------------------------------------------
-        // Paragraph
-        // ----------------------------------------------------------------------
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "text" );
-
-        // ----------------------------------------------------------------------
-        // Unordered list
-        // ----------------------------------------------------------------------
-
-        HtmlUnorderedList ul = (HtmlUnorderedList) elementIterator.next();
-        assertNotNull( ul );
-
-        HtmlListItem li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "list1" );
-
-        // ----------------------------------------------------------------------
-        // Paragraph
-        // ----------------------------------------------------------------------
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "text2" );
-
-        // ----------------------------------------------------------------------
-        // Unordered list
-        // ----------------------------------------------------------------------
-
-        ul = (HtmlUnorderedList) elementIterator.next();
-        assertNotNull( ul );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "list1" );
-
-        // ----------------------------------------------------------------------
-        // Paragraph
-        // ----------------------------------------------------------------------
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "text3" );
-
-        // ----------------------------------------------------------------------
-        // Unordered list
-        // ----------------------------------------------------------------------
-
-        ul = (HtmlUnorderedList) elementIterator.next();
-        assertNotNull( ul );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.getFirstDomChild().asText().trim(), "list1" );
-
-        assertFalse( elementIterator.hasNext() );
+        MultipleBlockVerifier verifier = new MultipleBlockVerifier();
+        verifier.verify( "target/output/multipleblock.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyMacro()
         throws Exception
@@ -546,518 +173,57 @@
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyEntitiesPage()
         throws Exception
     {
-        File entityTest = getTestFile( "target/output/entityTest.html" );
-        assertNotNull( entityTest );
-        assertTrue( entityTest.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( entityTest.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( h2.asText().trim(), "section name" );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( a.getAttributeValue( "name" ), "section_name" );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader4 h4 = (HtmlHeader4) elementIterator.next();
-        assertNotNull( h4 );
-        assertEquals( h4.asText().trim(), "Entities" );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "'&' '<' '>' '\"' ''' ' ' ' '" );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        h4 = (HtmlHeader4) elementIterator.next();
-        assertNotNull( h4 );
-        assertEquals( h4.asText().trim(), "Comment" );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        h4 = (HtmlHeader4) elementIterator.next();
-        assertNotNull( h4 );
-        assertEquals( h4.asText().trim(), "CDATA" );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "source" );
-
-        HtmlPreformattedText pre = (HtmlPreformattedText) elementIterator.next();
-        assertNotNull( pre );
-        assertEquals( pre.asText().trim(), "<project xmlns:ant=\"jelly:ant\">" );
-
-        assertFalse( elementIterator.hasNext() );
+        EntitiesVerifier verifier = new EntitiesVerifier();
+        verifier.verify( "target/output/entityTest.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyJavascriptPage()
         throws Exception
-    {
-        File jsTest = getTestFile( "target/output/javascript.html" );
-        assertNotNull( jsTest );
-        assertTrue( jsTest.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-
-        final List collectedAlerts = new ArrayList();
-        webClient.setAlertHandler( new CollectingAlertHandler( collectedAlerts ) );
-
-        HtmlPage page = (HtmlPage) webClient.getPage( jsTest.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertNotNull( div );
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( h2.asText().trim(), "Test" );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( a.getAttributeValue( "name" ), "Test" );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( p.asText().trim(), "You should see a JavaScript alert..." );
-
-        HtmlScript script = (HtmlScript) elementIterator.next();
-        assertNotNull( script  );
-        assertEquals( script.getAttributeValue( "type" ), "text/javascript" );
-        assertEquals( script.asText().trim(), "" );
-        final List expectedAlerts = Collections.singletonList( "Hello!" );
-        assertEquals( expectedAlerts, collectedAlerts );
+    {        
+        JavascriptVerifier verifier = new JavascriptVerifier();
+        verifier.verify( "target/output/javascript.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyFaqPage()
         throws Exception
     {
-        File faqTest = getTestFile( "target/output/faq.html" );
-        assertNotNull( faqTest );
-        assertTrue( faqTest.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( faqTest.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertEquals( h2.asText().trim(), "Oft Asked Questions" );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "name" ), "Oft_Asked_Questions" );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        element = (HtmlElement) elementIterator.next();
-        assertEquals( element.getTagName(), "b" );
-        assertEquals( element.asText().trim(), "Contributing" );
-
-        HtmlOrderedList ol = (HtmlOrderedList) elementIterator.next();
-        assertEquals( ol.getFirstDomChild().asText().trim(), "One stupid question & a silly answer?" );
-
-        HtmlListItem li = (HtmlListItem) elementIterator.next();
-        assertEquals( li.getFirstDomChild().asText().trim(), "One stupid question & a silly answer?" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "#stupid-question" );
-
-        element = (HtmlElement) elementIterator.next();
-        assertEquals( element.getTagName(), "b" );
-        assertEquals( element.asText().trim(), "stupid" );
-
-        p = (HtmlParagraph) elementIterator.next();
-        element = (HtmlElement) elementIterator.next();
-        assertEquals( element.getTagName(), "b" );
-        assertEquals( element.asText().trim(), "Using Maven" );
-
-        ol = (HtmlOrderedList) elementIterator.next();
-        assertEquals( ol.getFirstDomChild().asText().trim(), "How do I disable a report on my site?" );
-
-        li = (HtmlListItem) elementIterator.next();
-        assertNotNull( li );
-        assertEquals( li.getFirstDomChild().asText().trim(), "How do I disable a report on my site?" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "#disable-reports" );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        h2 = (HtmlHeader2) elementIterator.next();
-        assertEquals( h2.asText().trim(), "Contributing" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "name" ), "Contributing" );
-
-        HtmlDefinitionList dl = (HtmlDefinitionList) elementIterator.next();
-
-        HtmlDefinitionTerm dt = (HtmlDefinitionTerm) elementIterator.next();
-        assertEquals( dt.getFirstDomChild().asText().trim(), "One stupid question & a silly answer?" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "name" ), "stupid-question" );
-
-        element = (HtmlElement) elementIterator.next();
-        assertEquals( element.getTagName(), "b" );
-        assertEquals( element.asText().trim(), "stupid" );
-
-        HtmlDefinitionDescription dd = (HtmlDefinitionDescription) elementIterator.next();
-
-        p = (HtmlParagraph) elementIterator.next();
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "#Using_Maven" );
-        assertEquals( a.asText().trim(), "local link" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "./cdc.html" );
-        assertEquals( a.asText().trim(), "source document" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "http://maven.apache.org/?l=a&m=b" );
-        assertEquals( a.asText().trim(), "external link" );
-
-        element = (HtmlElement) elementIterator.next();
-        assertEquals( element.getTagName(), "i" );
-        assertEquals( element.asText().trim(), "italic" );
-
-        HtmlTable table = (HtmlTable) elementIterator.next();
-        assertEquals( table.getAttributeValue( "border" ), "0" );
-
-        element = (HtmlElement) elementIterator.next();
-        // this is a htmlunit bug
-        assertEquals( element.getTagName(), "tbody" );
-
-        HtmlTableRow tr = (HtmlTableRow) elementIterator.next();
-        HtmlTableDataCell td = (HtmlTableDataCell) elementIterator.next();
-        assertEquals( td.getAttributeValue( "align" ), "right" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "#top" );
-        assertEquals( a.asText().trim(), "[top]" );
-
-
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( div.getAttributeValue( "class" ), "section" );
-
-        h2 = (HtmlHeader2) elementIterator.next();
-        assertEquals( h2.asText().trim(), "Using Maven" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "name" ), "Using_Maven" );
-
-        dl = (HtmlDefinitionList) elementIterator.next();
-
-        dt = (HtmlDefinitionTerm) elementIterator.next();
-        assertEquals( dt.getFirstDomChild().asText().trim(), "How do I disable a report on my site?" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "name" ), "disable-reports" );
-
-        dd = (HtmlDefinitionDescription) elementIterator.next();
-
-        p = (HtmlParagraph) elementIterator.next();
-
-        element = (HtmlElement) elementIterator.next();
-        assertEquals( element.getTagName(), "tt" );
-        assertEquals( element.asText().trim(), "<source></source>" );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( div.getAttributeValue( "class" ), "source" );
-
-        HtmlPreformattedText pre = (HtmlPreformattedText) elementIterator.next();
-        assertEquals( pre.asText().trim(), "<source>1.5</source>" );
-
-        table = (HtmlTable) elementIterator.next();
-        assertEquals( table.getAttributeValue( "border" ), "0" );
-
-        element = (HtmlElement) elementIterator.next();
-        // this is a htmlunit bug
-        assertEquals( element.getTagName(), "tbody" );
-
-        tr = (HtmlTableRow) elementIterator.next();
-        td = (HtmlTableDataCell) elementIterator.next();
-        assertEquals( td.getAttributeValue( "align" ), "right" );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( a.getAttributeValue( "href" ), "#top" );
-        assertEquals( a.asText().trim(), "[top]" );
-
-        assertFalse( elementIterator.hasNext() );
+        FaqVerifier verifier = new FaqVerifier();
+        verifier.verify( "target/output/faq.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyAttributes()
         throws Exception
     {
-        File attributes = getTestFile( "target/output/attributes.html" );
-        assertNotNull( attributes );
-        assertTrue( attributes.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( attributes.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertEquals( "section", div.getAttributeValue( "class" ) );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( "section", h2.asText().trim() );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( "section", a.getAttributeValue( "name" ) );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-
-        assertEquals( "ID",  p.getAttributeValue( "id" ) );
-        assertEquals( "CLASS", p.getAttributeValue( "class" ) );
-        assertEquals( "TITLE", p.getAttributeValue( "title" ) );
-        assertEquals( "STYLE", p.getAttributeValue( "style" ) );
-        assertEquals( "LANG", p.getAttributeValue( "lang" ) );
-
-        HtmlImage img = (HtmlImage) elementIterator.next();
-        assertNotNull( img );
-
-        assertEquals( "project.png", img.getAttributeValue( "src" ) );
-        assertEquals( "150", img.getAttributeValue( "width" ) );
-        assertEquals( "93", img.getAttributeValue( "height" ) );
-        assertEquals( "border: 1px solid silver", img.getAttributeValue( "style" ) );
-        assertEquals( "Project", img.getAttributeValue( "alt" ) );
-
-        // test object identity to distinguish the case ATTRIBUTE_VALUE_EMPTY
-        assertTrue( img.getAttributeValue( "dummy" ) == HtmlElement.ATTRIBUTE_NOT_DEFINED );
-
-        HtmlTable table = (HtmlTable) elementIterator.next();
-        assertEquals( "1", table.getAttributeValue( "border" ) );
-        assertEquals( "none", table.getAttributeValue( "class" ) );
-
-        element = (HtmlElement) elementIterator.next();
-        // this is a htmlunit bug
-        assertEquals( "tbody", element.getTagName() );
-
-        HtmlTableRow tr = (HtmlTableRow) elementIterator.next();
-        HtmlTableHeaderCell th = (HtmlTableHeaderCell) elementIterator.next();
-
-        th = (HtmlTableHeaderCell) elementIterator.next();
-        assertEquals( "center", th.getAttributeValue( "align" ) );
-        assertEquals( "2", th.getAttributeValue( "colspan" ) );
-        assertEquals( "50%", th.getAttributeValue( "width" ) );
-
-        tr = (HtmlTableRow) elementIterator.next();
-
-        th = (HtmlTableHeaderCell) elementIterator.next();
-        assertEquals( "left", th.getAttributeValue( "align" ) );
-        assertEquals( "2", th.getAttributeValue( "rowspan" ) );
-        assertEquals( "middle", th.getAttributeValue( "valign" ) );
-
-        HtmlTableDataCell td = (HtmlTableDataCell) elementIterator.next();
-        td = (HtmlTableDataCell) elementIterator.next();
-        tr = (HtmlTableRow) elementIterator.next();
-        td = (HtmlTableDataCell) elementIterator.next();
-        td = (HtmlTableDataCell) elementIterator.next();
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-
-        UnknownHtmlElement unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "u", unk.getTagName());
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "s", unk.getTagName());
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "sub", unk.getTagName());
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "sup", unk.getTagName());
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "b", unk.getTagName());
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "i", unk.getTagName());
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "i", unk.getTagName());
-        unk = (UnknownHtmlElement) elementIterator.next();
-        assertEquals( "b", unk.getTagName());
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( "color: red; margin-left: 20px", p.getAttributeValue( "style" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "Anchor", a.getAttributeValue( "name" ) );
-
-        p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
-        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "./cdc.html", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "cdc.html", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "cdc.pdf", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "./cdc.txt", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "/index.html", a.getAttributeValue( "href" ) );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( "section", div.getAttributeValue( "class" ) );
-        h2 = (HtmlHeader2) elementIterator.next();
-        assertEquals( "Section without id", h2.asText().trim() );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "Section_without_id", a.getAttributeValue( "name" ) );
-
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( "section", div.getAttributeValue( "class" ) );
-        HtmlHeader3 h3 = (HtmlHeader3) elementIterator.next();
-        assertEquals( "Subsection without id", h3.asText().trim() );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "Subsection_without_id", a.getAttributeValue( "name" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "section-id", a.getAttributeValue( "name" ) );
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( "section", div.getAttributeValue( "class" ) );
-        h2 = (HtmlHeader2) elementIterator.next();
-        assertEquals( "Section with id", h2.asText().trim() );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "subsection-id", a.getAttributeValue( "name" ) );
-        div = (HtmlDivision) elementIterator.next();
-        assertEquals( "section", div.getAttributeValue( "class" ) );
-        h3 = (HtmlHeader3) elementIterator.next();
-        assertEquals( "Subsection with id", h3.asText().trim() );
-
-        assertFalse( elementIterator.hasNext() );
+        AttributesVerifier verifier = new AttributesVerifier();
+        verifier.verify( "target/output/attributes.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyMisc()
         throws Exception
     {
-        File misc = getTestFile( "target/output/misc.html" );
-        assertNotNull( misc );
-        assertTrue( misc.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( misc.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlApplet applet = (HtmlApplet) elementIterator.next();
-        assertEquals( "org.micro.applet.Main", applet.getAttributeValue( "code" ) );
-        assertEquals( "micro-applet.jar", applet.getAttributeValue( "archive" ) );
-
-        HtmlParameter param = (HtmlParameter) elementIterator.next();
-        assertEquals( "midlet", param.getAttributeValue( "name" ) );
-        assertEquals( "org.micro.applet.SimpleDemoMIDlet", param.getAttributeValue( "value" ) );
-
+        MiscVerifier verifier = new MiscVerifier();
+        verifier.verify( "target/output/misc.html" );
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyDocbookPageExists()
         throws Exception
@@ -1068,72 +234,12 @@
     }
 
     /**
-     * @throws Exception
+     * @throws Exception if something goes wrong.
      */
     public void verifyApt()
         throws Exception
     {
-        File attributes = getTestFile( "target/output/apt.html" );
-        assertNotNull( attributes );
-        assertTrue( attributes.exists() );
-
-        // HtmlUnit
-        WebClient webClient = new WebClient();
-        HtmlPage page = (HtmlPage) webClient.getPage( attributes.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator elementIterator = division.getAllHtmlChildElements();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlDivision div = (HtmlDivision) elementIterator.next();
-        assertEquals( "section", div.getAttributeValue( "class" ) );
-
-        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( "Links", h2.asText().trim() );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "Links", a.getAttributeValue( "name" ) );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "Anchor", a.getAttributeValue( "name" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "cdc.html", a.getAttributeValue( "name" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "#Anchor", a.getAttributeValue( "href" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "Anchor_with_space", a.getAttributeValue( "name" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "#Anchor_with_space", a.getAttributeValue( "href" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
-        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "http://maven.apache.org/", a.getAttributeValue( "href" ) );
-        assertEquals( "externalLink", a.getAttributeValue( "class" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "./cdc.html", a.getAttributeValue( "href" ) );
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "#cdc.html", a.getAttributeValue( "href" ) );
-
-        a = (HtmlAnchor) elementIterator.next();
-        assertEquals( "/index.html", a.getAttributeValue( "href" ) );
+        AptVerifier verifier = new AptVerifier();
+        verifier.verify( "target/output/apt.html" );
     }
 }

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java?rev=732140&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java Tue Jan  6 14:01:29 2009
@@ -0,0 +1,111 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader2;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader4;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+import com.gargoylesoftware.htmlunit.html.HtmlPreformattedText;
+
+import java.util.Iterator;
+
+
+/**
+ * 
+ *
+ * @author ltheussl
+ * @version $Id$
+ */
+public class EntitiesVerifier
+    extends AbstractVerifier
+{
+    /** {@inheritDoc} */
+    public void verify( String file )
+            throws Exception
+    {
+        HtmlPage page = htmlPage( file );
+        assertNotNull( page );
+
+        HtmlElement element = page.getHtmlElementById( "contentBox" );
+        assertNotNull( element );
+        HtmlDivision division = (HtmlDivision) element;
+        assertNotNull( division );
+
+        Iterator elementIterator = division.getAllHtmlChildElements();
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        HtmlDivision div = (HtmlDivision) elementIterator.next();
+        assertNotNull( div );
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
+        assertNotNull( h2 );
+        assertEquals( h2.asText().trim(), "section name" );
+
+        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
+        assertNotNull( a );
+        assertEquals( a.getAttributeValue( "name" ), "section_name" );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertNotNull( div );
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        HtmlHeader4 h4 = (HtmlHeader4) elementIterator.next();
+        assertNotNull( h4 );
+        assertEquals( h4.asText().trim(), "Entities" );
+
+        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+        assertEquals( p.asText().trim(), "'&' '<' '>' '\"' ''' ' ' ' '" );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertNotNull( div );
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        h4 = (HtmlHeader4) elementIterator.next();
+        assertNotNull( h4 );
+        assertEquals( h4.asText().trim(), "Comment" );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertNotNull( div );
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        h4 = (HtmlHeader4) elementIterator.next();
+        assertNotNull( h4 );
+        assertEquals( h4.asText().trim(), "CDATA" );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertNotNull( div );
+        assertEquals( div.getAttributeValue( "class" ), "source" );
+
+        HtmlPreformattedText pre = (HtmlPreformattedText) elementIterator.next();
+        assertNotNull( pre );
+        assertEquals( pre.asText().trim(), "<project xmlns:ant=\"jelly:ant\">" );
+
+        assertFalse( elementIterator.hasNext() );
+    }
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/EntitiesVerifier.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java?rev=732140&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java Tue Jan  6 14:01:29 2009
@@ -0,0 +1,215 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlDefinitionDescription;
+import com.gargoylesoftware.htmlunit.html.HtmlDefinitionList;
+import com.gargoylesoftware.htmlunit.html.HtmlDefinitionTerm;
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader2;
+import com.gargoylesoftware.htmlunit.html.HtmlListItem;
+import com.gargoylesoftware.htmlunit.html.HtmlOrderedList;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+import com.gargoylesoftware.htmlunit.html.HtmlPreformattedText;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableDataCell;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+
+import java.util.Iterator;
+
+
+/**
+ * 
+ *
+ * @author ltheussl
+ * @version $Id$
+ */
+public class FaqVerifier
+    extends AbstractVerifier
+{
+    /** {@inheritDoc} */
+    public void verify( String file )
+            throws Exception
+    {
+        HtmlPage page = htmlPage( file );
+        assertNotNull( page );
+
+        HtmlElement element = page.getHtmlElementById( "contentBox" );
+        assertNotNull( element );
+        HtmlDivision division = (HtmlDivision) element;
+        assertNotNull( division );
+
+        Iterator elementIterator = division.getAllHtmlChildElements();
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        HtmlDivision div = (HtmlDivision) elementIterator.next();
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
+        assertEquals( h2.asText().trim(), "Oft Asked Questions" );
+
+        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "name" ), "Oft_Asked_Questions" );
+
+        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
+        element = (HtmlElement) elementIterator.next();
+        assertEquals( element.getTagName(), "b" );
+        assertEquals( element.asText().trim(), "Contributing" );
+
+        HtmlOrderedList ol = (HtmlOrderedList) elementIterator.next();
+        assertEquals( ol.getFirstDomChild().asText().trim(), "One stupid question & a silly answer?" );
+
+        HtmlListItem li = (HtmlListItem) elementIterator.next();
+        assertEquals( li.getFirstDomChild().asText().trim(), "One stupid question & a silly answer?" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "#stupid-question" );
+
+        element = (HtmlElement) elementIterator.next();
+        assertEquals( element.getTagName(), "b" );
+        assertEquals( element.asText().trim(), "stupid" );
+
+        p = (HtmlParagraph) elementIterator.next();
+        element = (HtmlElement) elementIterator.next();
+        assertEquals( element.getTagName(), "b" );
+        assertEquals( element.asText().trim(), "Using Maven" );
+
+        ol = (HtmlOrderedList) elementIterator.next();
+        assertEquals( ol.getFirstDomChild().asText().trim(), "How do I disable a report on my site?" );
+
+        li = (HtmlListItem) elementIterator.next();
+        assertNotNull( li );
+        assertEquals( li.getFirstDomChild().asText().trim(), "How do I disable a report on my site?" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "#disable-reports" );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        h2 = (HtmlHeader2) elementIterator.next();
+        assertEquals( h2.asText().trim(), "Contributing" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "name" ), "Contributing" );
+
+        HtmlDefinitionList dl = (HtmlDefinitionList) elementIterator.next();
+
+        HtmlDefinitionTerm dt = (HtmlDefinitionTerm) elementIterator.next();
+        assertEquals( dt.getFirstDomChild().asText().trim(), "One stupid question & a silly answer?" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "name" ), "stupid-question" );
+
+        element = (HtmlElement) elementIterator.next();
+        assertEquals( element.getTagName(), "b" );
+        assertEquals( element.asText().trim(), "stupid" );
+
+        HtmlDefinitionDescription dd = (HtmlDefinitionDescription) elementIterator.next();
+
+        p = (HtmlParagraph) elementIterator.next();
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "#Using_Maven" );
+        assertEquals( a.asText().trim(), "local link" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "./cdc.html" );
+        assertEquals( a.asText().trim(), "source document" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "http://maven.apache.org/?l=a&m=b" );
+        assertEquals( a.asText().trim(), "external link" );
+
+        element = (HtmlElement) elementIterator.next();
+        assertEquals( element.getTagName(), "i" );
+        assertEquals( element.asText().trim(), "italic" );
+
+        HtmlTable table = (HtmlTable) elementIterator.next();
+        assertEquals( table.getAttributeValue( "border" ), "0" );
+
+        element = (HtmlElement) elementIterator.next();
+        // this is a htmlunit bug
+        assertEquals( element.getTagName(), "tbody" );
+
+        HtmlTableRow tr = (HtmlTableRow) elementIterator.next();
+        HtmlTableDataCell td = (HtmlTableDataCell) elementIterator.next();
+        assertEquals( td.getAttributeValue( "align" ), "right" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "#top" );
+        assertEquals( a.asText().trim(), "[top]" );
+
+
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        h2 = (HtmlHeader2) elementIterator.next();
+        assertEquals( h2.asText().trim(), "Using Maven" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "name" ), "Using_Maven" );
+
+        dl = (HtmlDefinitionList) elementIterator.next();
+
+        dt = (HtmlDefinitionTerm) elementIterator.next();
+        assertEquals( dt.getFirstDomChild().asText().trim(), "How do I disable a report on my site?" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "name" ), "disable-reports" );
+
+        dd = (HtmlDefinitionDescription) elementIterator.next();
+
+        p = (HtmlParagraph) elementIterator.next();
+
+        element = (HtmlElement) elementIterator.next();
+        assertEquals( element.getTagName(), "tt" );
+        assertEquals( element.asText().trim(), "<source></source>" );
+
+        div = (HtmlDivision) elementIterator.next();
+        assertEquals( div.getAttributeValue( "class" ), "source" );
+
+        HtmlPreformattedText pre = (HtmlPreformattedText) elementIterator.next();
+        assertEquals( pre.asText().trim(), "<source>1.5</source>" );
+
+        table = (HtmlTable) elementIterator.next();
+        assertEquals( table.getAttributeValue( "border" ), "0" );
+
+        element = (HtmlElement) elementIterator.next();
+        // this is a htmlunit bug
+        assertEquals( element.getTagName(), "tbody" );
+
+        tr = (HtmlTableRow) elementIterator.next();
+        td = (HtmlTableDataCell) elementIterator.next();
+        assertEquals( td.getAttributeValue( "align" ), "right" );
+
+        a = (HtmlAnchor) elementIterator.next();
+        assertEquals( a.getAttributeValue( "href" ), "#top" );
+        assertEquals( a.asText().trim(), "[top]" );
+
+        assertFalse( elementIterator.hasNext() );
+    }
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/FaqVerifier.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java?rev=732140&view=auto
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java (added)
+++ maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java Tue Jan  6 14:01:29 2009
@@ -0,0 +1,105 @@
+package org.apache.maven.doxia.siterenderer;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import com.gargoylesoftware.htmlunit.CollectingAlertHandler;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlDivision;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlHeader2;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+
+/**
+ * 
+ *
+ * @author ltheussl
+ * @version $Id$
+ */
+public class JavascriptVerifier
+    extends AbstractVerifier
+{
+    /**
+     * Verifies a HtmlPage.
+     *
+     * @param file the file to verify.
+     *
+     * @throws Exception if something goes wrong.
+     */
+    public void verify( String file )
+            throws Exception
+    {
+        File jsTest = getTestFile( "target/output/javascript.html" );
+        assertNotNull( jsTest );
+        assertTrue( jsTest.exists() );
+
+        // HtmlUnit
+        WebClient webClient = new WebClient();
+
+        final List collectedAlerts = new ArrayList();
+        webClient.setAlertHandler( new CollectingAlertHandler( collectedAlerts ) );
+
+        HtmlPage page = (HtmlPage) webClient.getPage( jsTest.toURI().toURL() );
+        assertNotNull( page );
+
+        HtmlElement element = page.getHtmlElementById( "contentBox" );
+        assertNotNull( element );
+        HtmlDivision division = (HtmlDivision) element;
+        assertNotNull( division );
+
+        Iterator elementIterator = division.getAllHtmlChildElements();
+
+        // ----------------------------------------------------------------------
+        //
+        // ----------------------------------------------------------------------
+
+        HtmlDivision div = (HtmlDivision) elementIterator.next();
+        assertNotNull( div );
+        assertEquals( div.getAttributeValue( "class" ), "section" );
+
+        HtmlHeader2 h2 = (HtmlHeader2) elementIterator.next();
+        assertNotNull( h2 );
+        assertEquals( h2.asText().trim(), "Test" );
+
+        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
+        assertNotNull( a );
+        assertEquals( a.getAttributeValue( "name" ), "Test" );
+
+        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
+        assertNotNull( p );
+        assertEquals( p.asText().trim(), "You should see a JavaScript alert..." );
+
+        HtmlScript script = (HtmlScript) elementIterator.next();
+        assertNotNull( script  );
+        assertEquals( script.getAttributeValue( "type" ), "text/javascript" );
+        assertEquals( script.asText().trim(), "" );
+        final List expectedAlerts = Collections.singletonList( "Hello!" );
+        assertEquals( expectedAlerts, collectedAlerts );
+    }
+}

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/doxia-sitetools/trunk/doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message