1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.xml.internal.html

File DefaultHTMLCleanerTest.java

 

Code metrics

0
99
22
1
413
286
22
0.22
4.5
22
1

Classes

Class Line # Actions
DefaultHTMLCleanerTest 56 99 0% 22 9
0.9256198492.6%
 

Contributing tests

This file is covered by 18 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.xml.internal.html;
21   
22    import java.io.StringReader;
23    import java.util.ArrayList;
24    import java.util.Collections;
25    import java.util.HashMap;
26    import java.util.List;
27    import java.util.Map;
28   
29    import org.junit.Assert;
30    import org.junit.Ignore;
31    import org.junit.Rule;
32    import org.junit.Test;
33    import org.xwiki.component.manager.ComponentLookupException;
34    import org.xwiki.test.annotation.ComponentList;
35    import org.xwiki.test.mockito.MockitoComponentMockingRule;
36    import org.xwiki.xml.html.HTMLCleaner;
37    import org.xwiki.xml.html.HTMLCleanerConfiguration;
38    import org.xwiki.xml.html.HTMLUtils;
39    import org.xwiki.xml.html.filter.HTMLFilter;
40    import org.xwiki.xml.internal.html.filter.AttributeFilter;
41    import org.xwiki.xml.internal.html.filter.BodyFilter;
42    import org.xwiki.xml.internal.html.filter.FontFilter;
43    import org.xwiki.xml.internal.html.filter.LinkFilter;
44    import org.xwiki.xml.internal.html.filter.ListFilter;
45    import org.xwiki.xml.internal.html.filter.ListItemFilter;
46    import org.xwiki.xml.internal.html.filter.UniqueIdFilter;
47   
48    /**
49    * Unit tests for {@link org.xwiki.xml.internal.html.DefaultHTMLCleaner}.
50    *
51    * @version $Id: 2e6480a7c7425ba31a6587ae08a10105a25039ce $
52    * @since 1.6M1
53    */
54    @ComponentList({ ListFilter.class, ListItemFilter.class, FontFilter.class, BodyFilter.class, AttributeFilter.class,
55    UniqueIdFilter.class, DefaultHTMLCleaner.class, LinkFilter.class })
 
56    public class DefaultHTMLCleanerTest
57    {
58    public static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
59    + "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
60    + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
61   
62    private static final String HEADER_FULL = HEADER + "<html><head></head><body>";
63   
64    private static final String FOOTER = "</body></html>\n";
65   
66    @Rule
67    public final MockitoComponentMockingRule<HTMLCleaner> mocker = new MockitoComponentMockingRule<HTMLCleaner>(
68    DefaultHTMLCleaner.class);
69   
 
70  1 toggle @Test
71    public void elementExpansion() throws ComponentLookupException
72    {
73  1 assertHTML("<p><textarea></textarea></p>", "<textarea/>");
74   
75    // Verify exceptions (by default elements are expanded).
76  1 assertHTML("<p><br /></p>", "<p><br></p>");
77  1 assertHTML("<hr />", "<hr>");
78    }
79   
 
80  1 toggle @Test
81    public void specialCharacters() throws ComponentLookupException
82    {
83    // TODO: We still have a problem I think in that if there are characters such as "&" or quote in the source
84    // text they are not escaped. This is because we have use "false" in DefaultHTMLCleaner here:
85    // Document document = new JDomSerializer(this.cleanerProperties, false).createJDom(cleanedNode);
86    // See the problem described here: http://sourceforge.net/forum/forum.php?thread_id=2243880&forum_id=637246
87  1 assertHTML("<p>&quot;&amp;**notbold**&lt;notag&gt;&nbsp;</p>",
88    "<p>&quot;&amp;**notbold**&lt;notag&gt;&nbsp;</p>");
89  1 assertHTML("<p>\"&amp;</p>", "<p>\"&</p>");
90  1 assertHTML("<p><img src=\"http://host.com/a.gif?a=foo&amp;b=bar\" /></p>",
91    "<img src=\"http://host.com/a.gif?a=foo&b=bar\" />");
92  1 assertHTML("<p>&#xA;</p>", "<p>&#xA;</p>");
93   
94    // Verify that double quotes are escaped in attribute values
95  1 assertHTML("<p value=\"script:&quot;&quot;\"></p>", "<p value='script:\"\"'");
96    }
97   
 
98  1 toggle @Test
99    public void closeUnbalancedTags() throws ComponentLookupException
100    {
101  1 assertHTML("<hr /><p>hello</p>", "<hr><p>hello");
102    }
103   
 
104  1 toggle @Test
105    public void conversionsFromHTML() throws ComponentLookupException
106    {
107  1 assertHTML("<p>this <strong>is</strong> bold</p>", "this <b>is</b> bold");
108  1 assertHTML("<p><em>italic</em></p>", "<i>italic</i>");
109  1 assertHTML("<del>strike</del>", "<strike>strike</strike>");
110  1 assertHTML("<del>strike</del>", "<s>strike</s>");
111  1 assertHTML("<ins>strike</ins>", "<u>strike</u>");
112  1 assertHTML("<p style=\"text-align:center\">center</p>", "<center>center</center>");
113  1 assertHTML("<p><span style=\"color:red;font-family:Arial;font-size:1.0em;\">This is some text!</span></p>",
114    "<font face=\"Arial\" size=\"3\" color=\"red\">This is some text!</font>");
115  1 assertHTML("<p><span style=\"font-size:1.6em;\">This is some text!</span></p>",
116    "<font size=\"+3\">This is some text!</font>");
117  1 assertHTML("<table><tbody><tr><td style=\"text-align:right;background-color:red;vertical-align:top\">"
118    + "x</td></tr></tbody></table>", "<table><tr><td align=right valign=top bgcolor=red>x</td></tr></table>");
119    }
120   
 
121  1 toggle @Test
122    public void convertImageAlignment() throws ComponentLookupException
123    {
124  1 assertHTML("<p><img style=\"float:left\" /></p>", "<img align=\"left\"/>");
125  1 assertHTML("<p><img style=\"float:right\" /></p>", "<img align=\"right\"/>");
126  1 assertHTML("<p><img style=\"vertical-align:top\" /></p>", "<img align=\"top\"/>");
127  1 assertHTML("<p><img style=\"vertical-align:middle\" /></p>", "<img align=\"middle\"/>");
128  1 assertHTML("<p><img style=\"vertical-align:bottom\" /></p>", "<img align=\"bottom\"/>");
129    }
130   
 
131  1 toggle @Test
132    public void convertImplicitParagraphs() throws ComponentLookupException
133    {
134  1 assertHTML("<p>word1</p><p>word2</p><p>word3</p><hr /><p>word4</p>", "word1<p>word2</p>word3<hr />word4");
135   
136    // Don't convert when there are only spaces or new lines
137  1 assertHTML("<p>word1</p> \n <p>word2</p>", "<p>word1</p> \n <p>word2</p>");
138   
139    // Ensure that whitespaces at the end works.
140  1 assertHTML("\n ", "\n ");
141   
142    // Ensure that comments are not wrapped
143  1 assertHTML("<!-- comment1 -->\n<p>hello</p>\n<!-- comment2 -->",
144    "<!-- comment1 -->\n<p>hello</p>\n<!-- comment2 -->");
145   
146    // Ensure that comments don't prevent other elements to be wrapped with paragraphs.
147  1 assertHTML("<!-- comment --><p><span>hello</span><!-- comment --></p><p>world</p>",
148    "<!-- comment --><span>hello</span><!-- comment --><p>world</p>");
149    }
150   
 
151  1 toggle @Test
152    public void cleanNonXHTMLLists() throws ComponentLookupException
153    {
154    // Fixing invalid list item.
155  1 assertHTML("<ul><li>item</li></ul>", "<li>item</li>");
156   
157  1 assertHTML("<ul><li>item1<ul><li>item2</li></ul></li></ul>", "<ul><li>item1</li><ul><li>item2</li></ul></ul>");
158  1 assertHTML("<ul><li>item1<ul><li>item2<ul><li>item3</li></ul></li></ul></li></ul>",
159    "<ul><li>item1</li><ul><li>item2</li><ul><li>item3</li></ul></ul></ul>");
160  1 assertHTML("<ul><li style=\"list-style-type: none\"><ul><li>item</li></ul></li></ul>",
161    "<ul><ul><li>item</li></ul></ul>");
162  1 assertHTML("<ul> <li style=\"list-style-type: none\"><ul><li>item</li></ul></li></ul>",
163    "<ul> <ul><li>item</li></ul></ul>");
164  1 assertHTML("<ul><li>item1<ol><li>item2</li></ol></li></ul>", "<ul><li>item1</li><ol><li>item2</li></ol></ul>");
165  1 assertHTML("<ol><li>item1<ol><li>item2<ol><li>item3</li></ol></li></ol></li></ol>",
166    "<ol><li>item1</li><ol><li>item2</li><ol><li>item3</li></ol></ol></ol>");
167  1 assertHTML("<ol><li style=\"list-style-type: none\"><ol><li>item</li></ol></li></ol>",
168    "<ol><ol><li>item</li></ol></ol>");
169  1 assertHTML("<ul><li>item1<ul><li style=\"list-style-type: none\"><ul><li>item2</li></ul></li>"
170    + "<li>item3</li></ul></li></ul>", "<ul><li>item1</li><ul><ul><li>item2</li></ul><li>item3</li></ul></ul>");
171   
172  1 assertHTML("<ul>\n\n<li style=\"list-style-type: none\"><p>text</p></li></ul>", "<ul>\n\n<p>text</p></ul>");
173  1 assertHTML("<ul><li>item<p>text</p></li><!--x--> </ul>", "<ul><li>item</li><!--x--> <p>text</p></ul>");
174  1 assertHTML("<ul> \n<li style=\"list-style-type: none\"><em>1</em>2<ins>3</ins></li><!--x--><li>item</li></ul>",
175    "<ul> \n<em>1</em><!--x-->2<ins>3</ins><li>item</li></ul>");
176    }
177   
178    /**
179    * Verify that scripts are not cleaned and that we can have a CDATA section inside. Also verify CDATA behaviors.
180    */
 
181  1 toggle @Test
182    public void scriptAndCData() throws ComponentLookupException
183    {
184  1 assertHTML("<script type=\"text/javascript\">//<![CDATA[\n\nalert(\"Hello World\")\n\n//]]></script>",
185    "<script type=\"text/javascript\"><![CDATA[\nalert(\"Hello World\")\n]]></script>");
186   
187  1 assertHTML("<script type=\"text/javascript\">//<![CDATA[\n//\nalert(\"Hello World\")\n\n//]]></script>",
188    "<script type=\"text/javascript\">//<![CDATA[\nalert(\"Hello World\")\n//]]></script>");
189   
190  1 assertHTML("<script type=\"text/javascript\">//<![CDATA[\n\nalert(\"Hello World\")\n\n//]]></script>",
191    "<script type=\"text/javascript\">/*<![CDATA[*/\nalert(\"Hello World\")\n/*]]>*/</script>");
192   
193  1 assertHTML("<script type=\"text/javascript\">//<![CDATA[\n\n\n" + "function escapeForXML(origtext) {\n"
194    + " return origtext.replace(/\\&/g,'&'+'amp;').replace(/</g,'&'+'lt;')\n"
195    + " .replace(/>/g,'&'+'gt;').replace(/\'/g,'&'+'apos;').replace(/\"/g,'&'+'quot;');" + "}\n\n\n//]]>"
196    + "</script>", "<script type=\"text/javascript\">\n" + "/*<![CDATA[*/\n"
197    + "function escapeForXML(origtext) {\n"
198    + " return origtext.replace(/\\&/g,'&'+'amp;').replace(/</g,'&'+'lt;')\n"
199    + " .replace(/>/g,'&'+'gt;').replace(/\'/g,'&'+'apos;').replace(/\"/g,'&'+'quot;');" + "}\n"
200    + "/*]]>*/\n" + "</script>");
201   
202  1 assertHTML("<script>//<![CDATA[\n<>\n//]]></script>", "<script>&lt;&gt;</script>");
203  1 assertHTML("<script>//<![CDATA[\n<>\n//]]></script>", "<script><></script>");
204   
205    // Verify that CDATA not inside SCRIPT or STYLE elements are considered comments in HTML and thus stripped
206    // when cleaned.
207  1 assertHTML("<p></p>", "<p><![CDATA[&]]></p>");
208  1 assertHTML("<p>&amp;&amp;</p>", "<p>&<![CDATA[&]]>&</p>");
209    }
210   
211    /**
212    * Verify that inline style elements are not cleaned and that we can have a CDATA section inside.
213    */
 
214  1 toggle @Test
215    public void styleAndCData() throws ComponentLookupException
216    {
217  1 assertHTMLWithHeadContent("<style type=\"text/css\">/*<![CDATA[*/\na { color: red; }\n/*]]>*/</style>",
218    "<style type=\"text/css\"><![CDATA[\na { color: red; }\n]]></style>");
219   
220  1 assertHTMLWithHeadContent("<style type=\"text/css\">/*<![CDATA[*/\na { color: red; }\n/*]]>*/</style>",
221    "<style type=\"text/css\">/*<![CDATA[*/\na { color: red; }\n/*]]>*/</style>");
222   
223  1 assertHTMLWithHeadContent("<style type=\"text/css\">/*<![CDATA[*/a>span { color: blue;}\n/*]]>*/</style>",
224    "<style type=\"text/css\">a&gt;span { color: blue;}</style>");
225   
226  1 assertHTMLWithHeadContent("<style>/*<![CDATA[*/<>\n/*]]>*/</style>", "<style>&lt;&gt;</style>");
227  1 assertHTMLWithHeadContent("<style>/*<![CDATA[*/<>\n/*]]>*/</style>", "<style><></style>");
228    }
229   
230    /**
231    * Verify that we can control what filters are used for cleaning.
232    */
 
233  1 toggle @Test
234    public void explicitFilterList() throws ComponentLookupException
235    {
236  1 HTMLCleanerConfiguration configuration = this.mocker.getComponentUnderTest().getDefaultConfiguration();
237  1 configuration.setFilters(Collections.<HTMLFilter>emptyList());
238  1 String result =
239    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader("something"), configuration));
240    // Note that if the default Body filter had been executed the result would have been:
241    // <p>something</p>.
242  1 Assert.assertEquals(HEADER_FULL + "something" + FOOTER, result);
243    }
244   
245    /**
246    * Verify that the restricted parameter works.
247    */
 
248  1 toggle @Test
249    public void restrictedHtml() throws ComponentLookupException
250    {
251  1 HTMLCleanerConfiguration configuration = this.mocker.getComponentUnderTest().getDefaultConfiguration();
252  1 Map<String, String> parameters = new HashMap<String, String>();
253  1 parameters.putAll(configuration.getParameters());
254  1 parameters.put("restricted", "true");
255  1 configuration.setParameters(parameters);
256   
257  1 String result =
258    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(
259    new StringReader("<script>alert(\"foo\")</script>"), configuration));
260  1 Assert.assertEquals(HEADER_FULL + "<pre>alert(\"foo\")</pre>" + FOOTER, result);
261   
262  1 result =
263    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(
264    new StringReader("<style>p {color:white;}</style>"), configuration));
265  1 Assert.assertEquals(HEADER_FULL + "<pre>p {color:white;}</pre>" + FOOTER, result);
266   
267    }
268   
269    /**
270    * Verify that passing a fully-formed XHTML header works fine.
271    */
 
272  1 toggle @Test
273    public void fullXHTMLHeader() throws ComponentLookupException
274    {
275  1 assertHTML("<p>test</p>", HEADER_FULL + "<p>test</p>" + FOOTER);
276    }
277   
278    /**
279    * Test {@link UniqueIdFilter}.
280    */
 
281  1 toggle @Test
282    public void duplicateIds() throws Exception
283    {
284  1 String actual = "<p id=\"x\">1</p><p id=\"xy\">2</p><p id=\"x\">3</p>";
285  1 String expected = "<p id=\"x\">1</p><p id=\"xy\">2</p><p id=\"x0\">3</p>";
286  1 HTMLCleanerConfiguration config = this.mocker.getComponentUnderTest().getDefaultConfiguration();
287  1 List<HTMLFilter> filters = new ArrayList<HTMLFilter>(config.getFilters());
288  1 filters.add(this.mocker.<HTMLFilter>getInstance(HTMLFilter.class, "uniqueId"));
289  1 config.setFilters(filters);
290  1 Assert.assertEquals(HEADER_FULL + expected + FOOTER,
291    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(actual), config)));
292    }
293   
294    /**
295    * Test that tags with a namespace are not considered as unknown tags by HTMLCleaner (see also <a
296    * href="http://jira.xwiki.org/browse/XWIKI-9753">XWIKI-9753</a>).
297    */
 
298  1 toggle @Test
299    public void cleanSVGTags() throws Exception
300    {
301  1 String input =
302    "<p>before</p>\n" + "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n"
303    + "<circle cx=\"100\" cy=\"50\" fill=\"red\" r=\"40\" stroke=\"black\" stroke-width=\"2\"></circle>\n"
304    + "</svg>\n" + "<p>after</p>\n";
305  1 assertHTML(input, HEADER_FULL + input + FOOTER);
306    }
307   
308    /**
309    * Test that cleaning works when there's a TITLE element in the body (but with a namespace). The issue was that
310    * HTMLCleaner would consider it a duplicate of the TITLE element in the HEAD even though it's namespaced. (see also
311    * <a href="http://jira.xwiki.org/browse/XWIKI-9753">XWIKI-9753</a>).
312    */
 
313  0 toggle @Test
314    @Ignore("See http://jira.xwiki.org/browse/XWIKI-9753")
315    public void cleanTitleWithNamespace() throws Exception
316    {
317    // Test with TITLE in HEAD
318  0 String input =
319    "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n"
320    + " <head>\n"
321    + " <title>Title test</title>\n"
322    + " </head>\n"
323    + " <body>\n"
324    + " <p>before</p>\n"
325    + " <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"300\" width=\"500\">\n"
326    + " <g>\n"
327    + " <title>SVG Title Demo example</title>\n"
328    + " <rect height=\"50\" style=\"fill:none; stroke:blue; stroke-width:1px\" width=\"200\" x=\"10\" "
329    + "y=\"10\"></rect>\n" + " </g>\n" + " </svg>\n" + " <p>after</p>\n";
330  0 Assert.assertEquals(HEADER + input + FOOTER,
331    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(input))));
332    }
333   
334    /**
335    * Verify that a xmlns namespace set on the HTML element is not removed by default and it's removed if
336    * {@link HTMLCleanerConfiguration#NAMESPACES_AWARE} is set to false.
337    */
 
338  0 toggle @Test
339    @Ignore("See https://sourceforge.net/p/htmlcleaner/bugs/168/")
340    public void cleanHTMLTagWithNamespace() throws Exception
341    {
342  0 String input = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>";
343   
344    // Default
345  0 Assert.assertEquals(HEADER + input + FOOTER,
346    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(input))));
347   
348    // Configured for namespace awareness being false
349  0 HTMLCleanerConfiguration config = this.mocker.getComponentUnderTest().getDefaultConfiguration();
350  0 config.setParameters(Collections.singletonMap(HTMLCleanerConfiguration.NAMESPACES_AWARE, "false"));
351  0 Assert.assertEquals(HEADER + "<html><head></head><body>" + FOOTER,
352    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(input), config)));
353    }
354   
355    /**
356    * Test that cleaning an empty DIV works (it used to fail, see <a
357    * href="http://jira.xwiki.org/browse/XWIKI-4007">XWIKI-4007</a>).
358    */
 
359  1 toggle @Test
360    public void cleanEmptyDIV() throws Exception
361    {
362  1 String input = "<div id=\"y\"></div><div id=\"z\">something</div>";
363  1 assertHTML(input, HEADER_FULL + input + FOOTER);
364    }
365   
 
366  1 toggle @Test
367    public void verifyLegendTagNotStripped() throws Exception
368    {
369  1 String input = "<fieldset><legend>test</legend><div>content</div></fieldset>";
370  1 assertHTML(input, HEADER_FULL + input + FOOTER);
371    }
372   
 
373  1 toggle @Test
374    public void verifySpanIsExpanded() throws Exception
375    {
376  1 assertHTML("<p><span class=\"fa fa-icon\"></span></p>", "<span class=\"fa fa-icon\" />");
377    }
378   
 
379  1 toggle @Test
380    public void verifyExternalLinksAreSecure() throws Exception
381    {
382  1 assertHTML("<p><a href=\"relativeLink\" target=\"_blank\">label</a></p>",
383    "<a href=\"relativeLink\" target=\"_blank\">label</a>");
384  1 assertHTML("<p><a href=\"http://xwiki.org\" rel=\" noopener noreferrer\" target=\"_blank\">label</a></p>",
385    "<a href=\"http://xwiki.org\" target=\"_blank\">label</a>");
386  1 assertHTML("<p><a href=\"http://xwiki.org\" rel=\" noopener noreferrer\" target=\"someframe\">label</a></p>",
387    "<a href=\"http://xwiki.org\" target=\"someframe\">label</a>");
388  1 assertHTML("<p><a href=\"http://xwiki.org\" target=\"_top\">label</a></p>",
389    "<a href=\"http://xwiki.org\" target=\"_top\">label</a>");
390  1 assertHTML("<p><a href=\"http://xwiki.org\" target=\"_parent\">label</a></p>",
391    "<a href=\"http://xwiki.org\" target=\"_parent\">label</a>");
392  1 assertHTML("<p><a href=\"http://xwiki.org\" target=\"_self\">label</a></p>",
393    "<a href=\"http://xwiki.org\" target=\"_self\">label</a>");
394  1 assertHTML("<p><a href=\"http://xwiki.org\" rel=\"noopener noreferrer\" target=\"_blank\">label</a></p>",
395    "<a href=\"http://xwiki.org\" target=\"_blank\" rel=\"noopener\">label</a>");
396  1 assertHTML("<p><a href=\"http://xwiki.org\" rel=\"noreferrer noopener\" target=\"_blank\">label</a></p>",
397    "<a href=\"http://xwiki.org\" target=\"_blank\" rel=\"noreferrer\">label</a>");
398  1 assertHTML("<p><a href=\"http://xwiki.org\" rel=\"hello noopener noreferrer\" target=\"_blank\">label</a></p>",
399    "<a href=\"http://xwiki.org\" target=\"_blank\" rel=\"hello\">label</a>");
400    }
401   
 
402  62 toggle private void assertHTML(String expected, String actual) throws ComponentLookupException
403    {
404  62 Assert.assertEquals(HEADER_FULL + expected + FOOTER,
405    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(actual))));
406    }
407   
 
408  5 toggle private void assertHTMLWithHeadContent(String expected, String actual) throws ComponentLookupException
409    {
410  5 Assert.assertEquals(HEADER + "<html><head>" + expected + "</head><body>" + FOOTER,
411    HTMLUtils.toString(this.mocker.getComponentUnderTest().clean(new StringReader(actual))));
412    }
413    }