"</head><body><frameset><frame src=\"frame.html\" /></frameset></body></html>";
StringWriter sw1 = new StringWriter();
new HtmlParser().parse(
new ByteArrayInputStream(test1.getBytes("UTF-8")),
makeHtmlTransformer(sw1), new Metadata(), new ParseContext());
String result = sw1.toString();
// <frame> tag should exist, with fully resolved URL
assertTrue(Pattern.matches("(?s).*<frame .* src=\"http://domain.com/frame.html\"/>.*$", result));
// <body> tag should not exist.
assertFalse(Pattern.matches("(?s).*<body>.*$", result));
// Test the example from the Nutch project.
final String test2 = "<html><head><title> my title </title></head><body>" +
"<frameset rows=\"20,*\"><frame src=\"top.html\"></frame>" +
"<frameset cols=\"20,*\"><frame src=\"left.html\"></frame>" +
"<frame src=\"invalid.html\"/></frame>" +
"<frame src=\"right.html\"></frame>" +
"</frameset></frameset></body></html>";
StringWriter sw2 = new StringWriter();
new HtmlParser().parse(
new ByteArrayInputStream(test2.getBytes("UTF-8")),
makeHtmlTransformer(sw2), new Metadata(), new ParseContext());
result = sw2.toString();
// <frame> tags should exist, with relative URL (no base element specified)
assertTrue(Pattern.matches("(?s).*<frame .* src=\"top.html\"/>.*$", result));