{
Element elem = document.createElement("script");
elem.setAttribute("language", "javascript");
elem.setAttribute("src", "http://localhost:8080/javascript/util.js");
elem.setAttribute("customAttribute", "<test>");
HeadElement headElem = new HeadElementImpl(elem);
String headElemString = HeadElementUtils.toString(headElem, false, true, false);
System.out.println("headElemString: " + headElemString);
assertTrue(headElem.getTextContent() == null || "".equals(headElem.getTextContent()));
assertFalse(headElemString.endsWith("</script>"));
headElemString = HeadElementUtils.toString(headElem, true, true, false);
System.out.println("headElemString: " + headElemString);
assertEquals(HeadElementUtils.toHtmlString(headElem), headElemString);
assertTrue(headElem.getTextContent() == null || "".equals(headElem.getTextContent()));
assertTrue(headElemString.endsWith("</script>"));
elem = document.createElement("script");
elem.setAttribute("language", "javascript");
elem.setTextContent("\r\nif (true) {\r\n\talert(\"<test/>\");\r\n}\r\n");
headElem = new HeadElementImpl(elem);
headElemString = HeadElementUtils.toString(headElem, true, true, false);
System.out.println("headElemString: " + headElemString);
assertEquals(HeadElementUtils.toHtmlString(headElem), headElemString);
assertFalse(headElem.getTextContent() == null || "".equals(headElem.getTextContent()));
assertTrue(headElemString.endsWith("</script>"));
headElemString = HeadElementUtils.toXhtmlString(headElem);
System.out.println("headElemString: " + headElemString);
assertFalse(headElem.getTextContent() == null || "".equals(headElem.getTextContent()));
assertTrue(headElemString.contains("<![CDATA["));
assertTrue(headElemString.contains("]]>"));
assertTrue(headElemString.endsWith("</script>"));
}